Performing 2D convolution
Show older comments
Hello,
I am new to image processing and had a conceptual question. I am currently trying to perform a 2D convolution of an image and a kernel (filter) in simulink using the 2D convolution block. I have code that transposes the image, then flips it, then performs the 2D convolution with the kernel. However from my (very limited) understanding convolution already flips the filter that I want to apply. I was told that the output of me transposing and flipping the image, then convolving with the kernel looks correct, however from my understanding I would be transposing and flipping the image once then convolving, which involves another flip, so therefore not actually convolving? I have read that this would just produce instead a correlation?
Hoping someone who knows more may be able to help give me a better understanding.
Thank you!
Accepted Answer
More Answers (1)
Image Analyst
on 9 Sep 2025
0 votes
@William Rose gave a good answer. Bottom line, I wouldn't do anything to your image in advance. Simply call conv2 and pass it the original image. Or you can call imfilter. It doesn't flip the kernel (not sure you need to, and don't for simple things like low pass or high pass filters) and imfilter gives you additional options for how edge computations are computed.
Categories
Find more on Image Filtering in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!