Find large area of image, and draw boundaries

16 views (last 30 days)
Philip on 27 May 2011
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!

Answers (1)

Walter Roberson
Walter Roberson on 27 May 2011
Threshold on the blue channel, label the resulting image, regionprops() and sort by area; if I recall, regionprops can return the boundary.
Image Analyst
Image Analyst on 29 May 2011
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().

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by