title: How to find corners on a Image using OpenCv
body: <p>I´m trying to find the corners on a image, I don´t need the contours, only the 4 corners. I will change the perspective using 4 corners.</p>
  
  <p>I´m using Opencv, but I need to know the steps to find the corners and what function I will use.</p>
  
  <p>My images will be like this:(without red points, I will paint the points after)
  <img src="https://i.stack.imgur.com/9CtnW.jpg" alt="enter image description here"></p>
  
  <p>EDITED:</p>
  
  <p>After suggested steps, I writed the code: (Note: I´m not using pure OpenCv, I´m using javaCV, but the logic it´s the same).</p>
  
  <pre><code>// Load two images and allocate other structures (I´m using other image)
      IplImage colored = cvLoadImage(
              "res/scanteste.jpg",
              CV_LOAD_IMAGE_UNCHANGED);
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/ag0Sa.jpg" alt="enter image description here"></p>
  
  <pre><code>    IplImage gray = cvCreateImage(cvGetSize(colored), IPL_DEPTH_8U, 1);
      IplImage smooth = cvCreateImage(cvGetSize(colored), IPL_DEPTH_8U, 1);
  
      //Step 1 - Convert from RGB to grayscale (cvCvtColor)
      cvCvtColor(colored, gray, CV_RGB2GRAY);
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/xCFht.png" alt="enter image description here"></p>
  
  <pre><code>    //2 Smooth (cvSmooth)
      cvSmooth( gray, smooth, CV_BLUR, 9, 9, 2, 2); 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/sgBAi.png" alt="enter image description here"></p>
  
  <pre><code>    //3 - cvThreshold  - What values?
      cvThreshold(gray,gray, 155, 255, CV_THRESH_BINARY);
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/79WA4.png" alt="enter image description here"></p>
  
  <pre><code>    //4 - Detect edges (cvCanny) -What values?
      int N = 7;
      int aperature_size = N;
      double lowThresh = 20;
      double highThresh = 40;     
      cvCanny( gray, gray, lowThresh*N*N, highThresh*N*N, aperature_size );   
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/01VZ0.png" alt="enter image description here"></p>
  
  <pre><code>    //5 - Find contours (cvFindContours)
      int total = 0;
      CvSeq contour2 = new CvSeq(null);
      CvMemStorage storage2 = cvCreateMemStorage(0);
      CvMemStorage storageHull = cvCreateMemStorage(0);
      total = cvFindContours(gray, storage2, contour2, Loader.sizeof(CvContour.class), CV_RETR_CCOMP, CV_CHAIN_APPROX_NONE);
      if(total &gt; 1){
            while (contour2 != null &amp;&amp; !contour2.isNull()) {
                if (contour2.elem_size() &gt; 0) {
                  //6 - Approximate contours with linear features (cvApproxPoly)
                    CvSeq points = cvApproxPoly(contour2,Loader.sizeof(CvContour.class), storage2, CV_POLY_APPROX_DP,cvContourPerimeter(contour2)*0.005, 0);
                    cvDrawContours(gray, points,CvScalar.BLUE, CvScalar.BLUE, -1, 1, CV_AA);
  
                }
                contour2 = contour2.h_next();
            }
  
      } 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Zj35W.png" alt="enter image description here"></p>
  
  <p>So, I want to find the cornes, but I don´t know how to use corners function like cvCornerHarris and others.</p>