This is a Go programme for pulling out contours/regions from an image.
It uses Moore-Neighbourhood contour tracing. For more details on the algorithm/approach see this site.
Forked from Ben Foxall's project in March 2024, and translated from Javascript to Go.
$ mncontours thingy.png
will create a file called thingy-mnc-t128m15A4L.svg. The numbers in the output SVG file name indicate the values used for the threshold, margin, and paper options -- in this case, the default values.
-
-t value,...
Specify one or more threshold values, separated by commas, each in the range 0..255. These are the pixel values that are used to find the contours. Default128
. Examples:-t 99
-t 32,64,96,128,160,192,224
-
-m margin
Define the minimum width, in mm, of the margin around the created image. Default 15. Example:-m 10
-
-p paper
Choose the paper size to use. One of A4L, A4P, A3L, or A3P. Default A4L. Example:-p A3L
mncontours beach.png -t 32,64,96,128,160,192,224
produces this: