Antonio Inglese
Antonio Inglese

Reputation: 55

Difference beetwen filter2d() with gaussian kernel and GaussianBlur()

I am a neophyte of opencv. I should perform operations for a project involving the use of a 2D low-pass Gaussian filter. The OpenCV that I use are 2.2 and inside there are two functions: filter2d () and GaussianBlur ().

Perform the same work? Let me explain, if filter2d () step a Gaussian kernel getGaussiankernel created with () and apply the filter and run it directly with GaussianBlur (), I will have the same result? It 'obvious that I will adopt the same values ​​for the two kernel functions.

Upvotes: 5

Views: 3827

Answers (2)

Sam
Sam

Reputation: 20056

GaussianBlur() is just a shortcut to the more complicated-to-set-up filter2d() with same kernel values. It performs the same thing, at the same speed, calling the same core function.

Upvotes: 4

greven
greven

Reputation: 643

The difference you might be seeing is that filter2D performs a cross correlation instead of the convolution operation. X-correlation and convolution give the same results when using simetrical kernels/filters. In order to perform a convolution using a kernel, you need to flip it and set the anchor point to the middle of the kernel. See the documentation: http://opencv.willowgarage.com/documentation/cpp/image_filtering.html#cv-filter2d

I'm not sure of the differences arise from there, but I needed to use convolution in my application and that's how I implemented it and it worked as expected.

Upvotes: 1

Related Questions