28#include <VisionX/interface/components/PointCloudAndImageAndCalibrationProviderInterface.h>
29#include <VisionX/interface/core/DataTypes.h>
47#include "Calibration/Calibration.h"
84 imageNoiseLeft(0) = imageNoiseLeft(1) =
86 imageNoiseRight(0) = imageNoiseRight(1) =
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(
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);
204 result = job.waitForResult();
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));
const covariance_type & getCovariance() const
void setCovariance(const covariance_type &cov)
void setMean(const value_type &mean)
Property< PropertyType > getProperty(const std::string &name)
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
virtual std::string getDefaultName() const =0
Retrieve default name of component.
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
std::string getName() const
Retrieve name of object.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
GridFileManager provides utility functions for working with files in Mongo GridFS and links to them s...
void enableResultImages(int numberImages, ImageDimension imageDimension, ImageType imageType, const std::string &name="")
Enables visualization.
void usingImageProvider(std::string name)
Registers a delayed topic subscription and a delayed provider proxy retrieval which all will be avail...
ImageProviderInfo getImageProvider(std::string name, ImageType destinationImageType=eRgb, bool waitForProxy=false)
Select an ImageProvider.
ImageFormatInfo imageFormat
Image format struct that contains all necessary image information.
std::string priorKnowledgeProxyName
CByteImage * cameraImages[2]
void onConnectImageProcessor() override
Called from framework.
std::string imageProviderName
ObjectLocalizerProcessor()
virtual void onConnectObjectLocalizerProcessor()
ObjectLocalizerProcessor interface: subclass hook.
void process() override
The process method is inherited from ImageProcessor.
std::string referenceFrameName
memoryx::ObjectLocalizationResultList localizeObjectClasses(const memoryx::ObjectClassNameList &objectClassNames, const Ice::Current &c=Ice::emptyCurrent) override
The process method is inherited from the ObjectLocalizationProcessorInterface and is called by the Wo...
void onInitImageProcessor() override
Called from framework.
boost::ptr_vector< boost::nullable< CByteImage > > resultImagesData
virtual void onInitObjectLocalizerProcessor()
ObjectLocalizerProcessor interface: subclass hook.
virtual bool addObjectClass(const memoryx::EntityPtr &objectClassEntity, const memoryx::GridFileManagerPtr &fileManager)=0
ObjectLocalizerProcessor interface: The addObjectClass method needs to be implemented by any ObjectLo...
CByteImage cameraImagesData[2]
memoryx::MultivariateNormalDistributionPtr calculateLocalizationUncertainty(Vec2d left_point, Vec2d right_point)
Calculate 3D uncertainty from two 2d points in left and right camera.
CStereoCalibration * getStereoCalibration() const
Retrieve stereo calibration corresponding to image provider.
CByteImage ** resultImages
#define ARMARX_INFO
The normal logging level.
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
#define ARMARX_VERBOSE
The logging level for verbose information.
MultivariateNormalDistributionPtr convertToMemoryX_MULTI(const Gaussian &gaussian)
IceInternal::Handle< ObjectRecognitionWrapper > ObjectRecognitionWrapperPtr
IceInternal::Handle< MultivariateNormalDistribution > MultivariateNormalDistributionPtr
IceInternal::Handle< Entity > EntityPtr
Typedef of EntityPtr as IceInternal::Handle<Entity> for convenience.