I am using Clion to code with opencv(a computer vision library), sometimes my code crashed , and clion show the crash code in opencv library,but I need to know where the code crashed in my code ,not in the opencv library. Add some print could help, but it's too slow to solve problem.
For example:I write some code below:
Mat image = imread("../1.jpg");
ROI_1 = image(rect1);
ROI_2 = image(rect2);
if the code crashed and show:
OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file /home/sgks/00-software/opencv-3.2.0/modules/core/src/matrix.cpp, line 522
terminate called after throwing an instance of 'cv::Exception'
Now I want to know, is code
ROI_1 = image(rect1); is wrong or
ROI_2 = image(rect2);is wrong