Extract outermost contour from a set of contours.
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Meghana Dinesh
am 20 Dez. 2014
Kommentiert: Image Analyst
am 22 Dez. 2014
I have an N X 2 matrix with the x,y co-ordinate values of the edges. I plot these co-ordinates (plotted in red displayed below in "Input Plot")
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/146539/image.bmp)
I want to extract the outermost contour (enclosing the largest area). How can this be done?
I have attached the N X 2 matrix with all x, y values (of input plot). I have also attached a .fig file of the input plot.
Regards.
2 Kommentare
Geoff Hayes
am 20 Dez. 2014
Sanya - you didn't attach the data and figure. Once you have chosen the file, you must press the Attach File button.
Akzeptierte Antwort
Image Analyst
am 20 Dez. 2014
I think using contour is the wrong approach, but I could be wrong. You don't even want all the contours -- you just want the outer boundary . What I would do is to threshold your image, then call imfill() to make the binary image solid, and then call bwareaopen() to get rid of the small noisy exterior regions. Then call bwboundaries to get a list of the outer perimeter's (x,y) coordinates.
binaryImage = grayImage > thresholdValue; % Threshold/binarize the image.
binaryImage = imfill(binaryImage, 'holes'); % Fill holes.
binaryImage = bwareaopen(binaryImage, 2000); % Remove small blobs.
boundaries = bwboundaries(binaryImage); % Get list of (x,y) coordinates of outer perimeter.
Attach your image if you want more help.
10 Kommentare
Image Analyst
am 22 Dez. 2014
No it doesn't. If you're going to deal with the image, like make measurements from it, you need to deal with pixels. Of course you can always upsize your image with imresize() to create more pixels.
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!