S
S
SergeySerge112022-02-17 00:15:25
Clustering
SergeySerge11, 2022-02-17 00:15:25

How to find ALL contours in an image?

Exactly Everything! I know how to shade 1 contour, and get an array of vertices. But I do not know optimally how to go through all such areas.
openCV has a findContours() function that finds all contours (a list of arrays of vertices), I would like to know the algorithm or the basic principles for its implementation.
Learned and understood several algorithms. For example, the selection of boundaries, the calculation of the value of the gradient of brightness Sobel operators. Area painting. As well as Outline Selection. BUT! Only One, the first point of which I found. And like the others there, almost O (n * n * n) complexity that I could come up with.
There are many contours in any processed image, plus each contour is divided into external and internal (the border line of the gradient is usually 2-3 pixels thick). extra inner line. And how to get through them all.
image-visualizing-simple-example-of-contour-detection-768x2811-1.jpg
Here is an example of 3 circuits. Let's say 1. I found, but how to go to others, it seems that it should be easy, but I can't think of it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wataru, 2022-02-17
@wataru

First, some machine vision algorithms (something related to contrast and color gradients, I'm not an expert here) find points that are boundaries. Then you can build a graph using them (neighboring points are connected by an edge). Then in the graph it is necessary to select all areas and the outer ones will be the contours of the objects. The region selection algorithm is well described here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question