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!