What am i doing: I’m trying to take the photo of a document(A4 page) and extract just the document portion and then warp it to look nice and tidy.
How am I doing it: So far, I’m finding the contours, and most likely the biggest contour will be the actual document.
I am then taking that and crop the bounding rectangle, but this is pretty bad if i want to warp it afterwards, because I don’t have the actual corners of the document.
So, the challenge right now is: How do i find a 4 corners poly that fits my document contour.
So this are the contours in the image:
And this is what I am trying to detect: a 4 corners polygon that matches the document contour (highlighted a poly):
Any idea how to achieve this?
Is there any better way to approach this challenge?