31#include <Calibration/StereoCalibration.h>
32#include <Image/ImageProcessor.h>
96 MetaPointCloudFormatPtr
99 MetaPointCloudFormatPtr info =
new MetaPointCloudFormat();
101 info->type = PointContentType::eColoredPoints;
102 info->capacity = 1600 * 1200 *
sizeof(ColoredPoint3D);
103 info->size = info->capacity;
126 StereoCalibrationProviderInterfacePrx calibrationProviderPrx1 =
127 StereoCalibrationProviderInterfacePrx::checkedCast(imageProviderPrx);
128 CapturingPointCloudAndImageAndStereoCalibrationProviderInterfacePrx
129 calibrationProviderPrx2 =
130 CapturingPointCloudAndImageAndStereoCalibrationProviderInterfacePrx::checkedCast(
133 if (calibrationProviderPrx1)
137 imagesAreUndistorted = calibrationProviderPrx1->getImagesAreUndistorted();
139 else if (calibrationProviderPrx2)
143 imagesAreUndistorted = calibrationProviderPrx2->getImagesAreUndistorted();
148 <<
" is not a StereoCalibrationProvider";
149 imagesAreUndistorted =
true;
152 cameraImages =
new CByteImage*[2];
155 width = imageProviderInfo.
imageFormat.dimension.width;
156 height = imageProviderInfo.
imageFormat.dimension.height;
157 cameraImagesGrey =
new CByteImage*[2];
158 cameraImagesGrey[0] =
new CByteImage(width, height, CByteImage::eGrayScale);
159 cameraImagesGrey[1] =
new CByteImage(width, height, CByteImage::eGrayScale);
160 disparityImage =
new CByteImage(width, height, CByteImage::eGrayScale);
161 disparityImageRGB =
new CByteImage(cameraImages[0]);
162 resultImages =
new CByteImage*[2];
163 resultImages[0] = cameraImages[0];
164 resultImages[1] = disparityImageRGB;
170 delete cameraImages[0];
171 delete cameraImages[1];
172 delete[] cameraImages;
173 delete cameraImagesGrey[0];
174 delete cameraImagesGrey[1];
175 delete[] cameraImagesGrey;
176 delete disparityImage;
177 delete disparityImageRGB;
178 delete[] resultImages;
184 setImageFormat(visionx::ImageDimension(width, height), visionx::eRgb);
197 std::unique_lock lock(captureLock);
210 pcl::PointCloud<PointXYZRGBA>::Ptr pointcloud(
new pcl::PointCloud<PointXYZRGBA>());
211 ::ImageProcessor::ConvertImage(cameraImages[0], cameraImagesGrey[0]);
212 ::ImageProcessor::ConvertImage(cameraImages[1], cameraImagesGrey[1]);
225 imagesAreUndistorted,
232 for (
size_t j = 0; j < pointcloud->height; j++)
234 for (
size_t i = 0; i < pointcloud->width; i++)
236 int idx = (j * pointcloud->width + i);
237 int value = pointcloud->points[idx].z;
240 disparityImageRGB->pixels[3 * idx + 0] = value & 0xFF;
241 disparityImageRGB->pixels[3 * idx + 1] = (value >> 8) & 0xFF;
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
virtual void onExitComponent()
Hook for subclass.
virtual void onDisconnectComponent()
Hook for subclass.
virtual void onConnectComponent()=0
Pure virtual hook for the subclass.
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)
virtual void onInitComponent()=0
Pure virtual hook for the subclass.
void onInitComponent() override
void usingImageProvider(std::string name)
Registers a delayed topic subscription and a delayed provider proxy retrieval which all will be avail...
bool waitForImages(int milliseconds=1000)
Wait for new images.
ImageProviderInfo getImageProvider(std::string name, ImageType destinationImageType=eRgb, bool waitForProxy=false)
Select an ImageProvider.
void onDisconnectComponent() override
int getImages(CByteImage **ppImages)
Poll images from provider.
void onConnectComponent() override
void onExitComponent() override
ImageFormatInfo imageFormat
Image format struct that contains all necessary image information.
void onInitComponent() override
void onDisconnectComponent() override
Hook for subclass.
void setImageFormat(ImageDimension imageDimension, ImageType imageType, BayerPatternType bayerPatternType=visionx::eBayerPatternRg)
Sets the image basic format data.
void provideImages(void **inputBuffers, const IceUtil::Time &imageTimestamp=IceUtil::Time())
send images raw.
void onConnectComponent() override
void setNumberImages(int numberImages)
Sets the number of images on each capture.
void onExitComponent() override
void providePointCloud(PointCloudPtrT pointCloudPtr)
offer the new point cloud.
void onInitComponent() override
void onConnectImageProcessor() override
Implement this method in the ImageProcessor in order execute parts when the component is fully initia...
bool doCapture() override
void onExitCapturingPointCloudProvider() override
void onDisconnectComponent() override
Hook for subclass.
void onExitImageProcessor() override
Exit the ImapeProcessor component.
void onStartCapture(float frameRate) override
void onInitCapturingPointCloudProvider() override
MetaPointCloudFormatPtr getDefaultPointCloudFormat() override
default point cloud format used to initialize shared memory
void onInitImageProcessor() override
Setup the vision component.
void onConnectComponent() override
void onStopCapture() override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onInitImageProvider() override
void onExitComponent() override
visionx::MonocularCalibration getMonocularCalibration(const ::Ice::Current &c=Ice::emptyCurrent) override
#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_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
void GetPointsFromDisparity(const CByteImage *pImageLeftColor, const CByteImage *pImageRightColor, const CByteImage *pImageLeftGrey, const CByteImage *pImageRightGrey, const int nDisparityPointDistance, pcl::PointCloud< pcl::PointXYZRGBA > &aPointsFromDisparity, CByteImage *pDisparityImage, const int imageWidth, const int imageHeight, CStereoCalibration *pStereoCalibration, bool imagesAreUndistorted, const bool smoothDisparities)