/mncontours

A Moore neighbour contour tracer

Primary LanguageGoMIT LicenseMIT

Moore-Neighbourhood Contours

Go workflow

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.

Status

Forked from Ben Foxall's project in March 2024, and translated from Javascript to Go.

Usage

$ 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.

Options

  • -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. Default 128. 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

Examples

mncontours beach.png -t 32,64,96,128,160,192,224 produces this:

Photo of breakwaters on a beach The same photo after processing, showing as the outlines of shapes