What do the 1D filters represent when using imfilter?

3 次查看(过去 30 天)
I am reading the source code of an algorithm that is used to process an image. It contains the following lines of code
imfilter(image, [0.25 0 -0.25]', 'circular');
...
imfilter(image, [1 0 -1], 'circular');
I don't get what these kernels [0.25 0 -0.25]' or [1 0 -1] represent. Shouldn't kernels be 2D if the input is an image? What exactly do these specific kernels do to the image? I have seen several examples of imfilter being applied to an image with kernels of this form and I don't understand what the results of these operations should be (when I read the source code).
Can someone provide some intuition?

回答(1 个)

Sambit Senapati
Sambit Senapati 2019-6-14
To my understanding filtering is process of either convolution or correleation of kernel with the image. This operation is possible even if the kernel is one dimensional.
  2 个评论
Sambit Senapati
Sambit Senapati 2019-6-17
"Shouldn't kernels be 2D if the input is an image?"
Its not necessary. Some algorithm might use 1D filtering.
"What exactly do these specific kernels do to the image?"
Think of like this: pixels are only dependent on neighborhood pixel in one direction. In this case in x-direction. In the code shared by you it seems like these kernels are derivative filters without taking the weight of diagonal neighbourhood pixel. Basically, we are taking derivative of image in x-direction.

请先登录,再进行评论。

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by