Finding Standard deviation of circles - OpenCV related
I can think of the following algorithm:

Build a KD-tree for all circle centers.
Now repeat the following:

i) choose a random circle A and find its closest neigbhour B. If there is a circle collision or the radius deviates more then some threshold mark B for later use. Repeat until an acceptable neigbour B is found. If none is found mark A for later use. If B was found redo the process to find C close to A. If no C found try close to B. If both A,B,C found mark as a trafic light signal. (Validate by measuring distance between circles and centers lining up)
ii) Now unmark non-trafic light circles and repeat i) until no more A,B,C can be found.
The whole algorithm resembles some variation of agglomorative clustering with clusters of 3 produced.
I have image with bunch of circles(intersecting and non intersecting circles) in it. I have to group each of them(non intersecting only) into group of three circles such that distance between circles must be minimum and have minimum standard deviation between them and return only one group with least distance and standard deviation between them for those circles.
Each Circle have values such x,y,r where x,y is the center of circle and r is the radius.
My main intention is to find traffic light signal(red,yellow and green circle) in a given image.