Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The bounding rectangle is calculated from your merged_contour_points1 variable which contains all the clustered blobs (except label == -1), that's why you have a rectangle that surrounds all the contours.

Instead, if you store only blobs with the same label, you will have:

Img res

If you want to retrieve only the contours (without clustering), with this tutorial: Img res2

Finally, the link to the DBSCAN algorithm implementation if someone want to use it, and to link to the original author.

The bounding rectangle is calculated from your merged_contour_points1 variable which contains all the clustered blobs (except label == -1), that's why you have a rectangle that surrounds all the contours.

Instead, if you store only blobs with the same label, you will have:

Img res

If you want to retrieve only the contours (without clustering), with this tutorial: Img res2

Finally, the link to the DBSCAN algorithm implementation if someone want to use it, and to link to the original author.

The bounding rectangle is calculated from your merged_contour_points1 variable which contains all the clustered blobs (except label == -1), that's why you have a rectangle that surrounds all the contours.

Instead, if you store only blobs with the same label, you will have:

Img resImg res

If you want to retrieve only the contours (without clustering), with this tutorial: Img res2Img res2

Note: There is a border contour in the original image and I remove it and I use the result of cv::boundingRect directly instead of displaying the bounding rectangle of the min area rectangle.

Finally, the link to the DBSCAN algorithm implementation if someone want to use it, and to the link to the original author.author post.