What do the 1D filters represent when using imfilter?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (1)
Sambit Senapati
am 14 Jun. 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 Kommentare
Sambit Senapati
am 17 Jun. 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.
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!