How do we write a MATLAB code that applies a rectangular moving average window to some random image that is on our computer?
1 回表示 (過去 30 日間)
古いコメントを表示
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 :)
2 件のコメント
Jan
2013 年 5 月 6 日
This is a part of your learning, but you want us to post the required code?! I assume, "learning" implies, that you try it at least by your own.
採用された回答
Image Analyst
2013 年 5 月 6 日
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.
2 件のコメント
Image Analyst
2013 年 5 月 7 日
Use this code:
blurredImage = conv2(yourImage, ones(windowSize)/windowSize^2);
to do a moving average while keeping the same average intensity. Using windowSize^2 will normalize it so that the mean stays the same.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!