title: OpenCV Android, drawing largest contour, something is wrong
body: <p>I am trying to draw a largest contour, I am working in realtime, processing each camera frame. 
  My input image is going to be hand, I have a few constraints - black background, no specular light.</p>
  
  <p>I expect largest contour to be as close as possible to below image<img src="https://i.stack.imgur.com/SNUM1.jpg" alt="enter image description here"></p>
  
  <p>My code is as below, I have referred many samples available online, and I am almost at a thought that there is nothing wrong in my code.</p>
  
  <pre><code>        mRgba = inputFrame.gray();
          contours = new ArrayList&lt;MatOfPoint&gt;();
          mcontours = new ArrayList&lt;MatOfPoint&gt;();
          List&lt;Mat&gt; hull = new ArrayList&lt;Mat&gt;(contours.size());
  
          hierarchy = new Mat();
          Imgproc.Canny(inputFrame.gray(), mIntermediateMat, 50, 50);
          Imgproc.findContours(mIntermediateMat, contours, hierarchy,
                  Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
  
  
          for (int idx = 0; idx != contours.size(); ++idx)
          {
              Mat contour = contours.get(idx);
              double contourarea = Imgproc.contourArea(contour);
              Log.i(TAG, "maxAreaIdx =" + idx + "contourarea = " + contourarea);
              if (contourarea &gt; maxArea)
              {
                  maxArea = contourarea;
                  maxAreaIdx = idx;
                  Log.i(TAG, "maxAreaIdx =" + maxAreaIdx + "MaxArea = " + maxArea);
  
              }
  
          }
  
          if(maxAreaIdx &gt; 0 &amp;&amp; maxAreaIdx &lt; contours.size())
              mcontours.add(contours.get(maxAreaIdx));
          else
              break;
  
          Imgproc.cvtColor(mIntermediateMat, mRgba, Imgproc.COLOR_GRAY2RGBA,
                  4);
          hierarchy.release();
          Imgproc.drawContours(mRgba, mcontours, -1, CONTOUR_COLOR, -1);
  </code></pre>
  
  <p>Now, all I get is a very small fraction of this. My current understanding is that OpenCV itself is not able detect big continuous contour. Please refer to images below.</p>
  
  <p><img src="https://i.stack.imgur.com/4G2cm.png" alt="enter image description here"></p>
  
  <p>Not only this, I tested it for other images as well, but I am somehow not able to get large big continuous contour.</p>
  
  <p>Am I wrong in applying Canny first? Is there a better technique? I wish to get outline of the hand contour. In future, I want to compare it with saved similar database of contours. Am I on the right track?</p>