Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



problem in contour/contourc
Posted:
Jan 14, 2012 11:08 PM


Hi, I want to extract the boundary points of a binary mask using contour/contourc for some application. But there are always some 'odd' points in the output of the function contour/contourc.
Try this codes:
[X,Y]=meshgrid(1:101,1:101); M=((X40).^2+(Y40).^2<400) a=contourc(M,[0 0])
a =
Columns 1 through 9
0.0000 21.0000 21.0000 21.0000 22.0000 22.0000 22.0000 23.0000 23.0000 157.0000 47.0000 47.0000 48.0000 49.0000 49.0000 50.0000 51.0000 51.0000
You can see the odd point (0, 157) in the first column in this case. The odd point may also appear in other position in other cases. This brings me problem to filter it out. Does anyone here know how to avoid it? Thanks!!



