Revision history [back]

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 StevenPuttemans 20029 ●16 ●82 ●207 http://stevenputtemans...

Faster method use connected componnet and find contours 1-Find contours

1. Find all connected components by using find FindContour method 2-Store method
2. Store contour for every Region(Connected componnet CC) 3-calculate CC)
3. calculate the Bounding Rect for every region (CC) 4-Loop (CC)
4. Loop in all region 5-For region
5. For every region , find the nearest regions depending on the Bounding rect 6-now 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 before.
7. repeat the proces for all regions

 3 No.3 Revision sturkmen 6772 ●3 ●48 ●79 https://github.com/stu...

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

EDIT: you can find sample implemention code here