1 | initial version |
Faster method use connected componnet and find contours 1-Find all connected components by using find FindContour method 2-Store contour for every Region(Connected componnet CC) 3-calculate the Bounding Rect for every region (CC) 4-Loop in all region 5-For every region , find the nearest regions depending on the Bounding rect 6-now you have the suspected regions which can be connected to region, compare the two contours and find the mimimum distance between the two contours , if the minimum distance is smaller than threshould (say 10 pixel) then now you can draw line from Point1 in first contour and point2 in second contour , Point1 and Point2 are the points which satisfy the minmum distance calculated before. 7-repeat the proces for all regions
2 | No.2 Revision |
Faster method use connected componnet and find contours
1-Find contours
3 | No.3 Revision |
Faster method use connected componnet and find contours
EDIT: you can find sample implemention code here