im = imread(image1, IMREAD_GRAYSCALE);
Mat PdivS = Mat(im.rows, im.cols, CV_32F);
double val1 = 0;
divide(P, S, PdivS);
minMaxLoc(PdivS, &min, &max);
double tempmax = max;
for (int x = 0; x < im.rows; x++)//To loop through all the pixels
{
for (int y = 0; y < im.cols; y++)
{
val1 = PdivS.at<double>(x, y); //<<<Give Unhandled exception
res = (val1 / tempmax) * 255;
PdivS.at<double>(x, y) = res;
}
}
When I tried using float on val1 and Mat::at, it doesn't have a problem. but when I change to double it give me.
Unhandled exception at 0x00007FFE727695FC in lineconnect.exe: Microsoft C++ exception: cv::Exception at memory location 0x0000007BA83DB690.
what shoud i do ?