How to group points using treshold? [closed]

asked 2020-01-19 13:39:33 -0500

alex1306 gravatar image

I have points list , from rectangle detector

points_list = [(1853, 1054), (1900, 1068), (75, 68), (74, 157), (10,500), (1700, 10), (1750,15) ]

threshold = 300 # X or Y distance between points How to group point using threshold? I need result:

[[(1853, 1054), (1900, 1068)], [(75, 68), (74, 157)], [(10,500)], [(1700, 10), (1750,12)]]

image description

I tried cv2.groupRectangles, but I need group points.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-09-17 06:17:05.440381

Comments

1

in c++ there is already an answer

LBerger gravatar imageLBerger ( 2020-01-19 13:50:45 -0500 )edit
1

kmeans().. (that is: IF you know, how many clusters to expect)

berak gravatar imageberak ( 2020-01-19 14:02:52 -0500 )edit

@LBerger, @berak Thanks a lot!!

alex1306 gravatar imagealex1306 ( 2020-01-19 14:28:02 -0500 )edit