title: adjust corners and crop the image openCV
body: <p>I am using open CV,in IOS.  I already detected the boundary of the paper sheet in an Image as show in image and , Now I have to drag these boundary line on touch for adjusting the crop frame. how we can adjust boundary line and how we can crop image inside the boundary?</p>
  
  <p>This is possible in openCV or I use openGL for this?</p>
  
  <p>@moosgummi : I call your method in below method </p>
  
  <pre><code>- (cv::Mat)finshWork:(cv::Mat &amp;)image
  {
  
  Mat img0 =image;
  
  Mat img1;
  cvtColor(img0, img1, CV_RGB2GRAY);
  
  // apply your filter
  Canny(img1, img1, 100, 200);
  
  // find the contours
  vector&lt; vector&lt;cv::Point&gt; &gt; contours;
  findContours(img1, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
  
  
  // you could also reuse img1 here
  Mat mask = Mat::zeros(img1.rows, img1.cols, CV_8UC1);
  
  // CV_FILLED fills the connected components found
  drawContours(mask, contours, -1, Scalar(255), CV_FILLED);
  
  
  // let's create a new image now
  Mat crop(img0.rows, img0.cols, CV_8UC3);
  
  // set background to green
  crop.setTo(Scalar(0,255,0));
  
  // and copy the magic apple
  img0.copyTo(crop, mask);
  
  // normalize so imwrite(...)/imshow(...) shows the mask correctly!
  normalize(mask.clone(), mask, 0.0, 255.0, CV_MINMAX, CV_8UC1);
  
  
  
  std::vector&lt;cv::Point&gt; biggestContour = contours[contours.size()-1];
  
  NSLog(@"%d",biggestContour[0].x);
  NSLog(@"%d",biggestContour[0].y);
  
  cv::Mat paperImage =[self getPaperAreaFromImage:image:biggestContour];
  
  
  //return crop;
  return paperImage;
  
  }
  </code></pre>
  
  <p>Thanks All</p>
  
  <p><img src="https://i.stack.imgur.com/hugyO.png" alt="enter image description here"></p>