- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi! I'm following this link http://www.samontab.com/web/2016/04/interfacing-intel-realsense-f200-with-opencv/ Interfacing Intel RealSense F200 with OpenCV – Sebastian Montabone but the device that i'm using is R200. I debugged the code and it showed the windows below:
But it is not streaming at all. What is this error below?
This is the code that i run as found from the link http://www.samontab.com/web/2016/04/interfacing-intel-realsense-f200-with-opencv/ Interfacing Intel RealSense F200 with OpenCV – Sebastian Montabone
# include
# include
PXCSenseManager *pxcSenseManager;
PXCImage * CVMat2PXCImage(cv::Mat cvImage)
{
PXCImage::ImageInfo iinfo;
memset(&iinfo, 0, sizeof(iinfo));
iinfo.width = cvImage.cols;
iinfo.height = cvImage.rows;
PXCImage::PixelFormat format;
int type = cvImage.type();
if (type == CV_8UC1)
format = PXCImage::PIXEL_FORMAT_Y8;
else if (type == CV_8UC3)
format = PXCImage::PIXEL_FORMAT_RGB24;
else if (type == CV_32FC1)
format = PXCImage::PIXEL_FORMAT_DEPTH_F32;
iinfo.format = format;
PXCImage *pxcImage = pxcSenseManager->QuerySession()->CreateImage(&iinfo);
PXCImage::ImageData data;
pxcImage->AcquireAccess(PXCImage::ACCESS_WRITE, format, &data);
data.planes[0] = cvImage.data;
pxcImage->ReleaseAccess(&data);
return pxcImage;
}
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;
else if (format == PXCImage::PIXEL_FORMAT_DEPTH)
type = CV_16UC1;
cv::Mat ocvImage = cv::Mat(cv::Size(width, height), type, data.planes[0]);
pxcImage->ReleaseAccess(&data);
return ocvImage;
}
int main(int argc, char* argv[])
{
//Define some parameters for the camera
cv::Size frameSize = cv::Size(640, 480);
float frameRate = 60;
//Create the OpenCV windows and images
cv::namedWindow("IR", cv::WINDOW_NORMAL);
cv::namedWindow("Color", cv::WINDOW_NORMAL);
cv::namedWindow("Depth", cv::WINDOW_NORMAL);
cv::Mat frameIR = cv::Mat::zeros(frameSize, CV_8UC1);
cv::Mat frameColor = cv::Mat::zeros(frameSize, CV_8UC3);
cv::Mat frameDepth = cv::Mat::zeros(frameSize, CV_8UC1);
//Initialize the RealSense Manager
pxcSenseManager = PXCSenseManager::CreateInstance();
//Enable the streams to be used
pxcSenseManager->EnableStream(PXCCapture::STREAM_TYPE_IR, frameSize.width, frameSize.height, frameRate);
pxcSenseManager->EnableStream(PXCCapture::STREAM_TYPE_COLOR, frameSize.width, frameSize.height, frameRate);
pxcSenseManager->EnableStream(PXCCapture::STREAM_TYPE_DEPTH, frameSize.width, frameSize.height, frameRate);
//Initialize the pipeline
pxcSenseManager->Init();
bool keepRunning = true;
while (keepRunning)
{
//Acquire all the frames from the camera
pxcSenseManager->AcquireFrame();
PXCCapture::Sample *sample = pxcSenseManager->QuerySample();
//Convert each frame into an OpenCV image
frameIR = PXCImage2CVMat(sample->ir, PXCImage::PIXEL_FORMAT_Y8);
frameColor = PXCImage2CVMat(sample->color, PXCImage::PIXEL_FORMAT_RGB24);
cv::Mat frameDepth_u16 = PXCImage2CVMat(sample->depth, PXCImage::PIXEL_FORMAT_DEPTH);
frameDepth_u16.convertTo(frameDepth, CV_8UC1);
cv::Mat frameDisplay;
cv::equalizeHist(frameDepth, frameDisplay);
//Display the images
cv::imshow("IR", frameIR);
cv::imshow("Color", frameColor);
cv::imshow("Depth", frameDisplay);
//Check for user input
int key = cv::waitKey(1);
if (key == 27)
keepRunning = false;
//Release the memory from the frames
pxcSenseManager->ReleaseFrame();
}
//Release the memory from the RealSense manager
pxcSenseManager->Release();
return 0;
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Gretchen_SMG-team,
Thanks for contacting Intel customer support.
Unfortunately through this channel we cannot debug your code or debug code from a third party site.
As a best effort to assist you I can share with you the following link from our developer zone were a developer was working on the OpenCV:
https://software.intel.com/en-us/forums/realsense/topic/599415 https://software.intel.com/en-us/forums/realsense/topic/599415
Additionally here is a video with an explanation on how to work on the OpenCV:
https://www.youtube.com/watch?v=wIkIdjN6Oyw https://www.youtube.com/watch?v=wIkIdjN6Oyw
And lastly here is a code sample on how to work on the OpenCV using LibrealSense:
https://software.intel.com/en-us/articles/using-librealsense-and-opencv-to-stream-rgb-and-depth-data https://software.intel.com/en-us/articles/using-librealsense-and-opencv-to-stream-rgb-and-depth-data
Hope this information helps you with your project.
Best Regards,
Juan N.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi! Thanks for the links. For your last link though, it's a project set up in Ubuntu. But i'm working with Windows.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page