Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to convert pxcimage into mat

hi, i want to convert pxcimage into mat variable.

below is my code: if (psm->AcquireFrame(true)<pxc_status_no_error) break;<="" p="">

    // retrieve all available image samples
    PXCCapture::Sample *sample = psm->QuerySample();



    //retrieve the image or frame by type from the sample
    colorIm = sample->color;
    depthIm = sample->depth;

    PXCImage *color_image = colorIm;
    PXCImage *depth_image = depthIm;

    PXCImage::ImageData colorImageData;
    PXCImage::ImageData depthImageData;

    color_image->AcquireAccess( PXCImage::ACCESS_READ, &colorImageData );
    depth_image->AcquireAccess( PXCImage::ACCESS_READ, &depthImageData );

    cvSetData( colorimg, (uchar*)colorImageData.planes[0], colorimg->width * 3 * sizeof(uchar) );
    cvSetData( depthimg, (short*)depthImageData.planes[0], depthimg->width * sizeof(short) );
    cvSetData( UVimg, (float*)depthImageData.planes[2], depthimg->width * sizeof(float) );

here i am trying to store the pxcimage data i.e, colorImageData, depthImageData into mat. as i am following c inteface of opencv. can any one help me to write store the same pxcimage data into mat in c++ inteface.

thanks

How to convert pxcimage into mat

hi, i want to convert pxcimage into mat variable.

below is my code: if (psm->AcquireFrame(true)<pxc_status_no_error) break;<="" p="">

code:

    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;
    depthIm = sample->depth;

    PXCImage *color_image = colorIm;
    PXCImage *depth_image = depthIm;

    PXCImage::ImageData colorImageData;
    PXCImage::ImageData depthImageData;

    color_image->AcquireAccess( PXCImage::ACCESS_READ, &colorImageData );
    depth_image->AcquireAccess( PXCImage::ACCESS_READ, &depthImageData );

    cvSetData( colorimg, (uchar*)colorImageData.planes[0], colorimg->width * 3 * sizeof(uchar) );
    cvSetData( depthimg, (short*)depthImageData.planes[0], depthimg->width * sizeof(short) );
    cvSetData( UVimg, (float*)depthImageData.planes[2], depthimg->width * sizeof(float) );

here i am trying to store the pxcimage data i.e, colorImageData, depthImageData into mat. as i am following c inteface of opencv. can any one help me to write store the same pxcimage data into mat in c++ inteface.

thanks