Ask Your Question

germano.gcf's profile - activity

2015-10-22 11:26:08 -0600 commented answer Access violation when using imwrite to save an imageMat

Thanks for the help. But it didn't work. It keeps returning to me this message:

    Unhandled exception at 0x000007FEE4DDE975 (opencv_world300.dll) in... Access Violation reading location...
2015-10-22 10:09:31 -0600 commented question Access violation when using imwrite to save an imageMat

I'm filling imageMat with depth values of a Kinect depth frame. For that, I'm using the following code:

    int i = 0;
    int j = 0;
            while (curr < dataEnd) {

        if (j == imageMat.cols){
            j = 0;
            i++;
        }

        // Get depth in millimeters
        USHORT depth = NuiDepthPixelToDepth(*curr++);
        imageMat.at<unsigned short>(i, j) = depth;
        j++;

    }
2015-10-21 16:59:33 -0600 asked a question Access violation when using imwrite to save an imageMat

Hi everybody!

I'm having an extremely annoying issue when tryig to save a PGN file with the depth value of a Kinect frame. I already have the millimeters Matrix in format.

 cv::Mat imageMat = cv::Mat(height, width, CV_16UC1);

I'm having a problem when I execute this:

vector<int> pars;
vector<unsigned char> image;
pars.push_back(CV_IMWRITE_PNG_COMPRESSION);
pars.push_back(3);
char *fmt = (char *)".png";
cv::imencode(fmt, imageMat, image, pars);
cv::imwrite("data.png", imageMat, pars);

The problem is actually in the last two lines. They both returns the same "Access violation while reading location at..."

Could anybody help me? I'm using OpenCV 3.0 on Visual Studio 2013.

Thank you all!