28 #include <VisionX/interface/components/PointCloudAndImageAndCalibrationProviderInterface.h>
29 #include <VisionX/interface/core/DataTypes.h>
47 #include "Calibration/Calibration.h"
53 resultImagesEnabled(true), imagesAreUndistorted(false), numberOfResultImages(2), job(this)
73 resultImagesEnabled = getProperty<bool>(
"EnableResultImages").getValue();
75 useResultImageMask = getProperty<bool>(
"useResultImageMask").getValue();
76 colorMask = getProperty<Eigen::Vector3i>(
"colorMask").getValue();
81 usingTopic(getProperty<std::string>(
"CalibrationUpdateTopicName").getValue());
84 imageNoiseLeft(0) = imageNoiseLeft(1) =
85 getProperty<float>(
"2DLocalizationNoise").getValue();
86 imageNoiseRight(0) = imageNoiseRight(1) =
87 getProperty<float>(
"2DLocalizationNoise").getValue();
104 StereoCalibrationInterfacePrx calibrationProvider =
105 StereoCalibrationInterfacePrx::checkedCast(imageProviderPrx);
107 if (calibrationProvider)
109 stereoCalibration.reset(
111 imagesAreUndistorted = calibrationProvider->getImagesAreUndistorted();
117 ARMARX_ERROR <<
"Unable to get calibration data. The image provider is not a "
118 "StereoCalibrationProvider";
122 if (resultImagesEnabled)
128 ImageDimension(imageFormat.dimension.width, imageFormat.dimension.height),
132 setupImages(imageFormat.dimension.width, imageFormat.dimension.height);
138 ObjectLocalizerProcessor::initObjectClasses()
144 classesSegmentPrx = priorKnowledgePrx->getObjectClassesSegment();
145 databasePrx = priorKnowledgePrx->getCommonStorage();
150 memoryx::CollectionInterfacePrx coll = databasePrx->requestCollection(
151 getProperty<std::string>(
"DataBaseObjectCollectionName").getValue());
152 classesSegmentPrx->addReadCollection(coll);
155 memoryx::EntityIdList idList = classesSegmentPrx->getAllEntityIds();
157 ARMARX_INFO <<
"Found " << idList.size() <<
" object classes in the class segments: "
158 << classesSegmentPrx->getReadCollectionsNS();
162 for (memoryx::EntityIdList::iterator iter = idList.begin(); iter != idList.end(); iter++)
165 memoryx::EntityPtr::dynamicCast(classesSegmentPrx->getEntityById(*iter));
176 if (recognitionWrapper->getRecognitionMethod() ==
getName())
180 std::string className = entity->getName();
188 <<
" object classes";
191 memoryx::ObjectLocalizationResultList
193 const memoryx::ObjectClassNameList& objectClassNames,
194 const Ice::Current&
c)
198 memoryx::ObjectLocalizationResultList result;
203 job.
start(objectClassNames);
206 catch (std::exception& e)
226 Eigen::MatrixXd combinedNoise(4, 4);
227 combinedNoise.setZero();
228 combinedNoise(0, 0) = imageNoiseLeft(0);
229 combinedNoise(1, 1) = imageNoiseLeft(1);
230 combinedNoise(2, 2) = imageNoiseRight(0);
231 combinedNoise(3, 3) = imageNoiseRight(1);
233 Eigen::VectorXd
mean(4);
234 mean << left_point.x, left_point.y, right_point.x, right_point.y;
246 Eigen::VectorXd base(4);
247 Eigen::VectorXd world(4);
249 Eigen::MatrixXd processedpoints(3, sigmapoints.cols());
251 for (
int n = 0; n < sigmapoints.cols(); n++)
254 Math2d::SetVec(l, sigmapoints(0, n), sigmapoints(1, n));
255 Math2d::SetVec(r, sigmapoints(2, n), sigmapoints(3, n));
258 stereoCalibration->Calculate3DPoint(l, r, w,
true,
true);
259 world << w.x, w.y, w.z, 1.0f;
261 processedpoints(0, n) = world(0);
262 processedpoints(1, n) = world(1);
263 processedpoints(2, n) = world(2);
279 Vec2d left2d, right2d;
281 Math3d::SetVec(pos, position(0), position(1), position(2));
287 Mat3d inverseHLeft, inverseHRight;
290 Math2d::ApplyHomography(inverseHLeft, left2d, left2d);
291 Math2d::ApplyHomography(inverseHRight, right2d, right2d);
297 ObjectLocalizerProcessor::setupImages(
int width,
int height)
303 cameraImage.Set(width, height, CByteImage::eRGB24);
308 resultImagesData.replace(i,
new CByteImage(width, height, CByteImage::eRGB24));