ねこでじ(Nekodigi)

Nekodigi’s diary

学習中の気づきをまとめています。応援よろしくお願いします

【Processing】Generate Polygon from Raster Image with Marching Square.

Abstract

f:id:Nekodigi:20210505105231g:plain
You can use this algorithm to get contours from an image.
It also turns clockwise or counterclockwise depending on whether it is facing inward or outward, which is convenient when draw it.

How it works.

We can find the contour by connecting around the sides of Marching Square.
I recommend you to watch this video to learn Marching Square.
www.youtube.com

Download

Iadded it to the Marching Square repository with the name Polygon_from_Raster_with_Marching_Square.
github.com