Skip to main content

plotting - Extracting the contour lines from an image



The Image presented is created by Mathematica ListPLot. It's a list of points out of a 512x512 grid, which meets criteria. I would like to be able to identify the points that make the contour, inside and outside, of the green "ears". Then with these points identified, average over the two contours and have a line that draws the shape. I'm not sure if this can be done in Mathematica and if it can, how to implement it. Any help would be appreciated


enter image description here


Update Another option would be to use a more restrictive criterion, which gives a plot like this.


enter image description here



Is there a way to make Mathematica connect the points and/or make a list of these points?



Answer



If you can specify your criteria as an set of inequalities:


criteria = x^4 + y^4 <= 1 && x^2 + y^2 > 0.5^2;

you can simply use ImplicitRegionand RegionBoundary:


r = ImplicitRegion[criteria, {x, y}]
Region[RegionBoundary[r]]

enter image description here



Comments