Ask Your Question

Revision history [back]

Hi,

Depending what the original image is there may be better filtering to perform first to get a more solid result. Below is a brief answer to your questions.

1 extract the contours of the image

this link is a tutorial on applying contours to an image after a canny edge detection. For more information on contours see this link

2 join lines that are close to one another

For this you might want to use a convex hull, see this link

3 if the lines form a closed loop -> box the object if it's just stray lines, ignore.

This should occur in step two when you are selecting the contours.