anti February 2016

OpenCv, get image information

I am playing around with an open source openCv application. With the provided image sets, it works great, but when I attempt to pass it a live camera stream, or even recorded frames from that camera stream, it crashes. I assume that this is to do with the cv::Mat type, differing image channels, or some conversion that i am not doing.

The provided dataset is grey-scale, 8 bit, and so are my images. The application expects grayscale (CV_8U).

My question is:

Given one of the (working) provided images, and one of my recorded (not working) images, what is the best way to compare them using opencv, to find out what the difference might be that is causing my crashes?

Thank you.

I have tried:

Commenting out this code (Which gave assertion errors)

  if(mImGray.channels()==3)
    {

            cvtColor(mImGray,mImGray,CV_BGR2GRAY);
            cvtColor(imGrayRight,imGrayRight,CV_BGR2GRAY);

    }
    else if(mImGray.channels()==4)
    {

            cvtColor(mImGray,mImGray,CV_BGRA2GRAY);
            cvtColor(imGrayRight,imGrayRight,CV_BGRA2GRAY);

    }

And replacing it with:

    cv::Mat TempL;
    mImGray.convertTo(TempL, CV_8U);
    cvtColor(TempL, mImGray, CV_BayerGR2BGR);
    cvtColor(mImGray, mImGray, CV_BGR2GRAY);

And the program crashes with no error...

Post Status

Asked in February 2016
Viewed 3,217 times
Voted 13
Answered 1 times

Search




Leave an answer