Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

"what should i do ?"

you probably should NOT write loops like that !

you have to be exact with the type in Mat::at(), if it's CV_32F, you have to use mat.at<float>().

second error is: it is at(row,col) , not (x,y) (so, out of bounds)

so, please delete the whole loop, it is not nessecary at all, since you can (and better should !) write it as:

divide(P, S, PdivS);
minMaxLoc(PdivS, &min, &max);
double tempmax = max;

PdivS *= 255.0/tempmax;  // all you need !

"what should i do ?"

you probably should NOT write loops like that !

you have to be exact with the type in Mat::at(), if it's CV_32F, you have to use mat.at<float>().

second error is: it is at(row,col) , not (x,y) (so, out of bounds)

so, please delete the whole loop, it is not nessecary at all, since you can (and better should !) write it as:

divide(P, S, PdivS);
minMaxLoc(PdivS, &min, &max);
double tempmax = max;

PdivS *= 255.0/tempmax;  // all you need !