- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Greeting,
I am working on obstacle detection using realsense, R200 camera and I am having a difficulty of converting PXCImage to a Mat format (OpenCV for further image processing). I used IplImage as an intermediate but i am loosing a lot of information when converting it to mat. i saw this effect (discontinuity on depth image) when i extracted the edge of depth image. what should i do? please anyone, I need help on this issue.
thank you in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have a look at this video that explains how to get the raw data from an F200, and convert the images into an OpenCV Mat object:
https://www.youtube.com/watch?v=wIkIdjN6Oyw
And here is the conversion shown in the video:
cv::Mat PXCImage2CVMat(PXCImage *pxcImage, PXCImage::PixelFormat format) { PXCImage::ImageData data; pxcImage->AcquireAccess(PXCImage::ACCESS_READ, format, &data); int width = pxcImage->QueryInfo().width; int height = pxcImage->QueryInfo().height; if(!format) format = pxcImage->QueryInfo().format; int type; if(format == PXCImage::PIXEL_FORMAT_Y8) type = CV_8UC1; else if(format == PXCImage::PIXEL_FORMAT_RGB24) type = CV_8UC3; else if(format == PXCImage::PIXEL_FORMAT_DEPTH_F32) type = CV_32FC1; cv::Mat ocvImage = cv::Mat(cv::Size(width, height), type, data.planes[0]); pxcImage->ReleaseAccess(&data); return ocvImage; }
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have a look at this video that explains how to get the raw data from an F200, and convert the images into an OpenCV Mat object:
https://www.youtube.com/watch?v=wIkIdjN6Oyw
And here is the conversion shown in the video:
cv::Mat PXCImage2CVMat(PXCImage *pxcImage, PXCImage::PixelFormat format) { PXCImage::ImageData data; pxcImage->AcquireAccess(PXCImage::ACCESS_READ, format, &data); int width = pxcImage->QueryInfo().width; int height = pxcImage->QueryInfo().height; if(!format) format = pxcImage->QueryInfo().format; int type; if(format == PXCImage::PIXEL_FORMAT_Y8) type = CV_8UC1; else if(format == PXCImage::PIXEL_FORMAT_RGB24) type = CV_8UC3; else if(format == PXCImage::PIXEL_FORMAT_DEPTH_F32) type = CV_32FC1; cv::Mat ocvImage = cv::Mat(cv::Size(width, height), type, data.planes[0]); pxcImage->ReleaseAccess(&data); return ocvImage; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i found it very useful.........thanks samontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Greeting,
i could not visualize how a realsense camera allocate memory to grab an image of PXCImage format. I was wondering if anyone can tell me about this two things
1. colorData.pitches[0]
2. data.planes[0];
thank you

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page