title: Automatic perspective correction OpenCV
body: <p>I am trying to implement Automatic perspective correction in my iOS program and when I use the test image I found on the tutorial everything works as expected. But when I take a picture I get back a weird result.</p>
  
  <p>I am using code found in this <a href="https://opencv-code.com/tutorials/automatic-perspective-correction-for-quadrilateral-objects/" rel="noreferrer">tutorial</a></p>
  
  <p>When I give it an image that looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/kMNcG.jpg" alt="enter image description here"></p>
  
  <p>I get this as the result:</p>
  
  <p><img src="https://i.stack.imgur.com/DFQwz.png" alt="enter image description here"></p>
  
  <p>Here is what <code>dst</code> gives me that might help.</p>
  
  <p><img src="https://i.stack.imgur.com/mpKG9.jpg" alt="enter image description here"></p>
  
  <p>I am using this to call the method which contains the code.</p>
  
  <p><code>quadSegmentation(Img, bw, dst, quad);</code></p>
  
  <p>Can anyone tell me when I am getting so many green lines compared to the tutorial? And how I might be able to fix this and properly crop the image to only contain the card?</p>