In my program I have to mix the c++ and c api a bit.
I capture an image with the c api and get one frame:
CvCapture* capture = 0;
capture = cvCaptureFromCAM(0);
// some code
IplImage* image = cvQueryFrame(capture);
Then it is converted to Mat
to be compatible with the new c++ api and I get a ROI:
Mat captureFrame = cvarrToMat(image);
// some code
Mat roi = captureFrame(roiRect);
At the end I have to convert the Mat back to IplImage* to work with the c api:
IplImage imgCaptureFrame = roi;
when I use this as reference &roi I get a
OpenCV Error: Assertion failed (svec[j].size == dst.size && svec[j].depth() == d
st.depth() && svec[j].channels() == 1 && i < dst.channels()) in unknown function
, file C:\slave\builds\WinInstallerMegaPack\src\opencv\modules\core\src\convert.
cpp, line 1306
in code using c api.
When I just use
IplImage imgCaptureFrame = captureFrame;
instead of
IplImage imgCaptureFrame = roi;
there isn't any error but then I don't have my roi.
What can I do to convert my roi to use it in c api?