Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

tracking boundary using opencv

I am trying to track/ trace boundary points in sequence from the following binary image:image description

I am using OpenCV (python). I am using three ways:

  1. Apply Canny edge detection to detect edge. Problem is how to get the sequence of points? It's work fine but it's very hard to get the sequence of boundary points
  2. Ideal option is to detect contours on the binary image. Because contours return the boundary points in sequence. But openCV contour method is not detecting the boundary as shown in the results. Why is this happening?
  3. Detect contours on the Canny edge. Still some boundary is missed ?? image description

Can anyone help me what's going on with OpenCV contours? Why it is not tracking the complete boundary. I am detecting contours as follows:

contours, hierarchy = cv2.findContours(thresh1,cv2.RETR_TREE ,cv2.CHAIN_APPROX_SIMPLE)

where thresh1 is the binary image