this code can work the image size 256x256, but not work on 4096x4096. I really confuse where get problem. the img.at(i,j) should not access invalid memory address.
void dustHighValue(Mat & img, float & sigma)
{
int m = img.rows;
int n = img.cols;
copyMakeBorder(img, img,2, 2, 2, 2, BORDER_CONSTANT, Scalar::all(0));
Mat tmp;
Scalar meanValue, stdValue;
for ( int i=2; i(i,j) > (sigma * stdValue[0] + meanValue[0]))
{
img.at(i,j) = meanValue[0];
}
}
img=img(Rect(2,2,n,m));
}
↧