MATLAB: How do we write a MATLAB code that applies a rectangular moving average window to some random image that is on our computer

convolutionmoving averages

I need the MATLAB code for a rectangular moving average window for an image that is in my computer. It is a part of the my self learning 🙂

Best Answer

Try this:
blurredImage = conv2(yourImage, ones(windowSize));
You'll get a few errors if you have a uint8 image or color image, but they should be easy to figure out. Let me know if you can't.