well the question says it all
I have some contour and I want to get the best quadrangular out of it
I had a problem with cards with rounded corners where even if I got approxPolyDP()
to return only 4 points/edges it was never the best because the "corners" were frequently picked to be closer to these rounded edges. My solution involved increasing the number of points returned to follow the corners and then my problem allowed me to relatively safely assume that the four longest edges found represented the sides. Take these four longest edges in order and find where each pair intersects and you have the points of the quad.
As a bonus you already have the lengths so you can feed the points to your perspective transform in the right order so it doesn't get squashed and stretched the wrong way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With