title: HOW TO get corners in a contour in opencv
body: <p>I am working in C++ and opencv</p>
  
  <p>I am detecting the big contour in an image because I have a black area in it.<img src="https://i.stack.imgur.com/HM7wm.jpg" alt="My image"></p>
  
  <p>In this case, the area is only horizontally, but it can be in any place.</p>
  
  <pre><code>Mat resultGray;
   cvtColor(result,resultGray, COLOR_BGR2GRAY);
   medianBlur(resultGray,resultGray,3);
   Mat resultTh;
   Mat canny_output;
      vector&lt;vector&lt;Point&gt; &gt; contours;
      vector&lt;Vec4i&gt; hierarchy;
   Canny( resultGray, canny_output, 100, 100*2, 3 );
  
      findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
      Vector&lt;Point&gt; best= contours[0];
      int max_area = -1;
      for( int i = 0; i &lt; contours.size(); i++ ) {
              Scalar color = Scalar( 0, 0, 0 );
  
              if(contourArea(contours[i])&gt; max_area)
              {
                  max_area=contourArea(contours[i]);
                  best=contours[i];
              }
      }
      Mat approxCurve;
      approxPolyDP(Mat(best),approxCurve,0.01*arcLength(Mat(best),true),true);
  </code></pre>
  
  <p>Wiht this, i have the big contour and it approximation (in approxCurve). Now, I want to obtain the corners of this approximation and get the image inside this contour, but I dont know how can I do it.</p>
  
  <p>I am using this <a href="https://stackoverflow.com/questions/10632617/how-to-remove-black-part-from-the-image">How to remove black part from the image?</a>
  But the last part I dont understad very well.</p>
  
  <p>Anyone knows how can I obtain the corners? It is another way more simple that this?</p>
  
  <p>Thanks for your time,</p>