필터 지우기
필터 지우기

Extract outermost contour from a set of contours.

조회 수: 10 (최근 30일)
Meghana Dinesh
Meghana Dinesh 2014년 12월 20일
댓글: Image Analyst 2014년 12월 22일
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")
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
Geoff Hayes
Geoff Hayes 2014년 12월 20일
Sanya - you didn't attach the data and figure. Once you have chosen the file, you must press the Attach File button.
Meghana Dinesh
Meghana Dinesh 2014년 12월 21일
oops. sorry. I have attached the files here: https://www.dropbox.com/sh/npibrtphxlvsm1t/AAC4mO8rM2fgYnJ8wC-S1kNca?dl=0

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2014년 12월 20일
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
Meghana Dinesh
Meghana Dinesh 2014년 12월 22일
Right! Thank you.
How about my second point? To obtain co-ordinates in subpixels? The plot has sub-pixel accuracy right? (Since the thickness of the line is less than 1 pixel)
Image Analyst
Image Analyst 2014년 12월 22일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Display Point Clouds에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by