Get the coordinates of a curve

I have a binary figure. I'd like to find the contour of the bright part. I used h=contour(mat,[x,x]); However, I do not need MATLAB to plot h. I just need the value of h. Is there a proper parameter of contour or another matlab function?

 Accepted Answer

Walter Roberson
Walter Roberson on 8 Jan 2013
You can use contourc to do the contour calculations without displaying any contour.
I would suggest to you that regionprops() would likely be more appropriate than contour(). contour() on a binary image is just going to look like a morophological filtering of the binary image.

More Answers (1)

Image Analyst
Image Analyst on 8 Jan 2013
I'm not sure why you think you need h, the handle to a contour group. Don't you think either bwboundaries() or bwperim() would give you what you want?

4 Comments

Thank you all the same. However, I need the pixels of the boundary arranged counter-clockwise or clockwise. contour() and contourc() are better choices.
http://www.mathworks.com/help/images/ref/bwtraceboundary.html allows you to select clockwise vs counter-clockwise.
Oh,sorry. It's my fault.
Image Analyst
Image Analyst on 8 Jan 2013
Edited: Image Analyst on 8 Jan 2013
Are you saying that bwboundaries does not give coordinates in an adjacent CW or CCW order? That they're in raster scan order or something? I'm pretty sure that is not the case.

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!