cv::Mat mask(45, 45, CV_32F, 0);
cv::Mat roi1(mask, cv::Rect(0, 0, 15, 15));
cv::Mat roi2(mask, cv::Rect(15, 0, 15, 15));
cv::sum(roi1); // no access violation
cv::sum(roi2); // access violation
Why is there an access violation when trying to get the sum of roi2? It seems that it's clearly inside the boundaries of mask.
Using Visual Studio 2010 and OpenCV 2.4.10