What do the 1D filters represent when using imfilter?

5 ビュー (過去 30 日間)
nbro
nbro 2019 年 6 月 2 日
コメント済み: Sambit Senapati 2019 年 6 月 17 日
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 件のコメント
nbro
nbro 2019 年 6 月 14 日
How does this answer my question?
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