How to distinguish flat and non flat regions of an image?
14 次查看(过去 30 天)
显示 更早的评论
Hello, I need to distinguish flat (regions having almost same pixel values e.g.sky,grass ) and non-flat regions of an image. I don't have any idea. Kindly suggest some ideas (any algorithm or some commands) how can i do the same in MATLAB.
0 个评论
采纳的回答
Image Analyst
2015-5-2
You can use stdfilt() or entropyfilt(). For example
% Get an image where the value is the std dev of a local neighborhood.
filteredImage = stdfilt(grayImage);
% Find pixels where the local standard deviation is 0
flatRegions = filteredImage == 0;
You can get relatively flat regions by using <= instead of ==
flatRegions = filteredImage <= 4; % Or whatever number you want.
0 个评论
更多回答(1 个)
harpreet
2015-5-3
编辑:harpreet
2015-5-3
2 个评论
Image Analyst
2015-5-3
Please attach the original image, not a screenshot.
What is the "flat" region? Is it all the white area? Or the red pixels inside the red discs? Or both?
And why did your algorithm give giant black squares around the red discs? I can't figure that out.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Read, Write, and Modify Image 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

