title: OpenCV - Detection of rectangle or pentagon
body: <p>How can I detect an rectangle or pentagon from an image using OpenCV? I have lot of  pictures of name card and I must detect their sides.The name card actually rectangle but sometimes name card corners cropped.I have tried <code>HoughLinesP()</code> function but it's just finding lines.</p>
  <p>I must detect the shape above the picture, which means I need to detect the name card edges regardless of that shape rectangle or pentagon and need to crop only name card object from the Image.</p>
  <p><img src="https://i.stack.imgur.com/KHFFg.png" alt="" /></p>
  <hr />
  <p>Expected Result:</p>
  <p><a href="https://i.stack.imgur.com/sP86V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sP86V.png" alt="Expected Result" /></a></p>