Sunday, October 13, 2013

Image Filtering Basics: Convolution and Correlation - II

As we discussed in the previous post opencv allows us to perform convolution and correlations easily.
Actually opencv lets you perform correlation only. There is difference in correlation and convolution,
for performing convolution we first rotate mask chosen by 180 degree and then apply the procedure discussed in the part I of this post.

More formally correlation is defined as
whereas convolution is defined as
As you can see negative arguments in case of mask F are have negative sign. This corresponds to reflection against x and y axis or in other words rotation by 180 degrees. 
In standard literature mask is also known as kernel, we will follow this convention throughout this blog here onward.

The filter2D is a function provided by opencv to perform correlation
Signature of filter2D.


Mat src : source image.
Mat dst : destination image.
ddepth : image depth of the destination.
kernel : Mask function.
Anchor : represents location of anchor/ origo w.r.t the kernel.
delta : a value to be added to each pixel during convolution.
Border_Type : Way to pad image.

Original Image

With blur operator of size 5x5

No comments:

Post a Comment