Marching squares: Difference between revisions

m
Line 46:
# Find contours at a constant value of 0.1 and extract the first one found
contours = round(measure.find_contours(example, 0.1))[0]
print('[', ', '.join([str((p[1], 65 - p[0])) for p in contours]), ']')
</lang>{{out}}
<pre>
[ (3.0, 10.0), (2.0, 21.0), (2.0, 21.0), (1.0, 32.0), (1.0, 43.0), (2.0, 54.0), (3.0, 54.0), (4.0, 43.0), (4.0, 32.0), (4.0, 21.0), (3.0, 10.0) ]
</pre>
 
4,102

edits