- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
i am trying to get the frame acquired from realsense camera into mat variable and show the live stream of camera using imshow();
here is the code :-
int wmain(int argc, WCHAR* argv[])
{
// initialize the util render
UtilRender renderColor(L"Color");
// create the PXCSenseManager
PXCSenseManager *psm=0;
psm = PXCSenseManager::CreateInstance();
if (!psm) {
wprintf_s(L"Unable to create the PXCSenseManager\n");
return 1;
}
/* Collects command line arguments */
UtilCmdLine cmdl(psm->QuerySession());
if (!cmdl.Parse(L"-listio-nframes-sdname-csize-dsize-isize-file-record-noRender-mirror",argc,argv)) return 3;
// select the color stream of size 640x480 and depth stream of size 320x240
psm->EnableStream(PXCCapture::STREAM_TYPE_COLOR, 640, 480);
// initialize the PXCSenseManager
if(psm->Init() != PXC_STATUS_NO_ERROR) return 2;
PXCImage *colorIm, *depthIm;
for (int i=0; i<MAX_FRAMES; i++) {
// This function blocks until all streams are ready (depth and color)
// if false streams will be unaligned
if (psm->AcquireFrame(true)<PXC_STATUS_NO_ERROR) break;
// retrieve all available image samples
PXCCapture::Sample *sample = psm->QuerySample();
// retrieve the image or frame by type from the sample
colorIm = sample->color;
// Mat conversion
PXCImage::ImageData mCImageData; //Color Image data..)
PXCImage *img = colorIm;
if (img->AcquireAccess(PXCImage::ACCESS_READ, &mCImageData) >= PXC_STATUS_NO_ERROR)
{
IplImage* colorimg = cvCreateImageHeader(cvSize(640,480), 8, 3);
cvSetData(colorimg, (uchar*)mCImageData.planes[0], 640*3*sizeof(char));
Mat image(colorimg);
imshow("RGB", image);
}
// release or unlock the current frame to fetch the next frame
psm->ReleaseFrame();
}
// close the last opened streams and release any session and processing module instances
psm->Release();
return 0;
}
when i run this code
error occurs---------- Run-Time Check Failure #3 - The variable 'mCImageData' is being used without being initialized.-----------
what should i do.
thanks !!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try using the C++ interface of OpenCV, so cv::Mat instead of IplImage.
Search in this forum, there a few OpenCV examples here.

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