Creating shapes from Canny Edge Detection in Canvas

Does anyone have an idea on how I can create shapes from Canny Edge Detection in Canvas?

+4
source share
2 answers

I assume that you already have a Canny edge Deployment , depending on how you formulate the question -

You can use an approach such as this one (written in Java, but should be simple enough to translate into JavaScript) and / or perhaps some limited use of fitting approaches (statistical).

The bottom line is that you will need to figure out which pixels are connected, and create objects or arrays of polygons yourself based on the result of edge detection.

Once you have the pixels connected, you can use dot reduction algorithms such as the Ramer-Douglas-Peucker algorithm ( JavaScript implementation here ) to avoid the polygons containing each point of similar oblique lines, etc.

You will encounter many problems, such as short segmented lines due to too much noise in the original image or “weak lines”, clusters of “lines”, which makes it difficult to understand how to connect them as polygons.

+5
source

, :

  • getImageData() []
  • ( )

().

EDIT - , , .

, , , Hough Transform , , .

0

All Articles