What do the 1D filters represent when using imfilter?

3 vues (au cours des 30 derniers jours)
nbro
nbro le 2 Juin 2019
Commenté : Sambit Senapati le 17 Juin 2019
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?

Réponses (1)

Sambit Senapati
Sambit Senapati le 14 Juin 2019
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 commentaires
nbro
nbro le 14 Juin 2019
How does this answer my question?
Sambit Senapati
Sambit Senapati le 17 Juin 2019
"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.

Connectez-vous pour commenter.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by