title: OpenCV - find or access shape contour not surrounded by bg, only separated by an outline
body: <p>I've been trying to find the contour of a single shape in a very plain background using OpenCV's <code>findContour</code> (I'd like to use the C++ syntax). However, it keeps on making its outline a contour and not the shape itself. I'm thinking it's because of the white edge resulted from Canny which doesn't make the shape closed.</p>
  
  <p><img src="https://i.stack.imgur.com/Pt0Ih.jpg" alt=""></p>
  
  <p>Case A: Shape is by the image's edge
  (This is not the actual input image but a simpler input image to illustrate this problem.)</p>
  
  <p><img src="https://i.stack.imgur.com/lY5G8.jpg" alt=""> <img src="https://i.stack.imgur.com/dI2aZ.jpg" alt=""></p>
  
  <p>Case B: Background surrounds the shape</p>
  
  <p><img src="https://i.stack.imgur.com/Q9fTw.jpg" alt=""> <img src="https://i.stack.imgur.com/EnKqB.jpg" alt=""></p>
  
  <p>There are the main functions I used:</p>
  
  <pre><code>findContours( grayImage, contours, hierarchy, RETR_LIST,CHAIN_APPROX_SIMPLE);
  approxPolyDP(Mat(contours.at(largestContourIndex)),poly,3,true);
  drawContours(output, contours, largestContourIndex, RGB(250,0,100), -1, 8, hierarchy, 0, Point() );
  </code></pre>
  
  <p>EDIT: Skipping edge detection gives the contour I need but I need to have the best contour approximate I can get.</p>
  
  <p>Thanks in advance.</p>