GaussianBlur in-place filtering

asked 2017-11-06 23:28:40 -0600

cfolson gravatar image

The documentation for the GaussianBlur method claims that it supports in-place filtering, but I get different results depending on whether the commented line is included. I can not determine why this should happen. Can anyone give me any feedback?

void findEdges(const Mat &src, Mat &destination, Size blur, float sigmaX, float sigmaY, int lowThresh, int highThresh) {

Mat foo = src.clone();
flip(foo, destination, 1);
Mat foo2 = destination.clone();
cvtColor(foo2, destination, COLOR_BGR2GRAY);
Mat foo3 = destination.clone();
// foo3 = destination;
GaussianBlur(foo3, destination, blur, sigmaX, sigmaY);
Mat foo4 = destination.clone();
Canny(foo4, destination, lowThresh, highThresh);

}

edit retag flag offensive close merge delete

Comments

I have tested your code and it works fine. If I sum up the image in the different scenarios I'm getting the same values

cv::Scalar val = cv::sum(destination);
std::cout << val[0] << std::endl;

so what are your results?

VxW gravatar imageVxW ( 2017-11-07 04:19:45 -0600 )edit

I get different results for the same image (4.62072e+7, 4.65682e+7). I am running OpenCV 3.3 with Visual Studio 2015 (opencv-3.3.0-vc14.exe).

cfolson gravatar imagecfolson ( 2017-11-07 09:52:19 -0600 )edit

that's strange. Now I played a little bit with the parameters sigmaxy. If sigmaxy = 0 everything is fine and the output is the same. If sigmaxy is e.g. "5" I also get different results. Sorry I have no idea. Maybe someone else knows more

VxW gravatar imageVxW ( 2017-11-08 02:05:31 -0600 )edit