opencv euclidean clustering vs findContours

后端 未结 2 1869
借酒劲吻你
借酒劲吻你 2020-12-10 16:35

I have the following image mask:

I want to apply something similar to cv::findContours, but that algorithm only joins connected points in the s

2条回答
  •  借酒劲吻你
    2020-12-10 17:02

    I suggest to use DBSCAN algorithm. It is exactly what you are looking for. Use a simple Euclidean Distance or even Manhattan Distance may work better. The input is all white points(threshold-ed). The output is a groups of points(your connected component)

    Here is a DBSCAN C++ implenetation

    EDIT: I tried DBSCAN my self and here is the result:

    As you see, Just the really connected points are considered as one cluster.

    This result was obtained using the standerad DBSCAN algorithm with EPS=3 (static no need to be tuned) MinPoints=1 (static also) and Manhattan Distance

提交回复
热议问题