Find large area of image, and draw boundaries
6 次查看(过去 30 天)
显示 更早的评论
Does anybody know of a way to identify a large area of an image (I have segmented the image first to make this easier), and then to draw around the edge of that object?
Here is an example of what I mean:
A large object in this image is the sky - so I would like to draw a boundary around it which will essentially show the horizon of the image.
Many thanks as always for all your help!
0 个评论
回答(1 个)
Walter Roberson
2011-5-27
Threshold on the blue channel, label the resulting image, regionprops() and sort by area; if I recall, regionprops can return the boundary.
2 个评论
Image Analyst
2011-5-29
No, there's no way to do it without thresholding. No matter what you call it - segmentation, classification, or whatever - eventually it all comes down to thresholding because you're going to have to say what's sky (foreground) and what's "not sky" (background), and that's thresholding. You may have to come up with an algorithm to find the threshold automatically though, as it may change from one image to the next. Your image has a bunch of colors that are adjacent to each other. Nobody and no computer knows what you consider to be blue unless you tell it how close it's allowed to be to another color - again, essentially that's thresholding.
You can get the sky from both your images from thresholding to get a binary image and then call bwboundaries().
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!