Why do we need to flip the kernel in 2D convolution?
Ältere Kommentare anzeigen
Why do we need to flip the kernel in 2D convolution in the first place? What's the benefit of this? So, why can't we leave it unflipped? What kind of terrible thing can happen if you don't flip it?
SEE: "First, flip the kernel, which is the shaded box, in both horizontal and vertical direction"
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 2 Mai 2013
Bearbeitet: Image Analyst
am 2 Mai 2013
1 Stimme
It doesn't need to be flipped, at least not by you. You pass in the array and the flipping is done internally, automatically, because that's the definition of convolution. If it didn't flip, it would be correlation, not convolution. If you flipped it before passing it into conv2(), then you'd be doing a correlation instead of a convolution because the internal flip in counteracted by your advance manual flip. If you want, you can use imfilter() or xcorr2() which do no flip internally.
3 Kommentare
Adnan Khan
am 18 Sep. 2017
How flipping is done internally? though it is clear from the formula that it is done but how can we explain this in simple and concise words...
Image Analyst
am 18 Sep. 2017
Flip it left to right using fliplr(), then flip it top to bottom with flipud().
Webi Dabuse
am 29 Sep. 2020
Or you can just rotate it by 180 degrees. rot90(image,2)
Kategorien
Mehr zu Signal Processing Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!