I am trying to do a camera calibration and met problems in separating points into two clusters.
sample image: For example, as shown in the image, there are eight rectangles with similar size. A, B, C, D, E, F, G, H are their centers. I want to cluster A,B,C,D into one list, cluster E,F,G,H into another list.
My brute idea is to find all combinations of 4 points , then do line fitting. The best fitting two lines(with the smallest bias) should be line ABCD and line EFGH. Therefore, I can get them separated.
However, I am wondering if there is a better way to do this? Or is there any library I can make use of in python/opencv?
Thanks a lot in advance.
The classic approach for this in computer vision (that everybody in CV should know) is to use a Hough transform . Then find density peaks in this projection.
Peaks in the Hough transformed space correspond to lines in the original space that contain multiple points.
There is a clustering algorithm based on this idea: CASH. But IMHO it's mostly interesting to use if your input data is more than 2 dimensional.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.