How to find largest axis aligned rectangle inside a contour
Hello,
I want to find biggest largest axis aligned rectangle inside a contour? I've found the contour (findContours) and approximated it (approxPolyDP). Now I need to find biggest axis aligned rectangle that fits inside the contour's approximated polygon.
UPDATE: The contour is approximately a rectangle. The problem I want to solve it to remove black areas around a stitched panoramic image.
I tried:
Approach #1 This approach fits my needs but I don't like the heuristic.
Approach #2 This approach assumes that the image has no black areas to the top and to the left of the image which is not acceptable in my case.
Any help will be appreciated. Thanks!