I am new to OpenCV image processing. My task is simple. I have to get 1/4th of an image (lower 1/4). The size of the image is 320 x 240. I used ROI Rect
in a Mat
object to get it.
Mat img_roi;
img_roi= image(cv::Rect(0,180,320,240));
I get the following error:
First-chance exception at 0x7669c41f in first.exe: Microsoft C++ exception: cv::Exception >at memory location 0x0041ec30.. Unhandled exception at 0x7669c41f in first.exe: Microsoft C++ exception: cv::Exception at >memory location 0x0041ec30..
If I specify Rect(0,0,320,60)
in the above code, I am getting the result (which is upper half) and the code works for some other values, for eg Rect (0,0,320,240)
, i.e., a full image. But not with lower quarter values (0,180,320,240).
I should also tell that I am getting the result by using Iplimage
. Only Mat
object creates the problem.
I would be really thankful if any of you can guide me in solving this.