开发者

OpenCV : is a contour closed or not

I am tryig to find a way to determine if a contour is closed or not,

but I am usign findContours and not cvFindContours so I dont have the flags..

Any idea how to do it?

By the way, I was asked to find the number of loops in the contour,

(meaning how many times he crosses himself).

Is it possible that 开发者_开发知识库a single contour will have loops?

If so, any idea of how to find how many there are?

Thanks,

Tamir.


i think that you can't detect the contours which have intersections using cvFindContours. if this function return the contours which are have a intersection than you can be sure that this contour is a loop. If the contour have 1 intersection for example imagine the contour corresponded to number "8" than cvFindContours return 3 contours, the 2 circles and the large outlier. I think you must use the graph theory for this task. create graph where the vertex is the pixels which lie in the contour, and the edges of graph is the neighbor pixels in the image. than you can find the all loops in the graph.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜