I use visual studio 2012 with opencv 3.0. I already checked several post about this issue but still I get assertion failed error -215 when I run this code:
IplImage * imageOriginal = cvLoadImage("road1.jpg"); int width = 0, height = 0; width = imageOriginal->width; height = imageOriginal->height; IplImage* img = cvCreateImage(cvGetSize(imageOriginal), imageOriginal->depth , 3); CvRect cropRect = cvRect(0, 0, width -10, height -10 ); // ROI in source image cvSetImageROI(imageOriginal, cropRect); try { cvCopy(imageOriginal, img, NULL); // Copies only crop region } catch (cv::Exception& e) { cout << e.what() << endl; } cvResetImageROI(imageOriginal); cvShowImage( "Original ROI", img); waitKey();
If I leave the rectangle to be full size CvRect cropRect = cvRect(0, 0, width, height);
I get no error. What is the problem?