Rigid perspective correction
Our first trial to do perspective correction will be a rigid one. We will follow these steps:
- Convert the input image to grayscale.
- Use the Canny edge detector to get the edge image.
- Detect the lines in the edge image using the probabilistic Hough transform.
- Find the bounding lines of the object of interest.
- Estimate the bounding rectangle of the object of interest; hence the name rigid because the object doesn't need to have parallel opposite sides, but we will enforce this by using a rectangular estimation to the quadrilateral object.
- Build a list of the rectangle's four corners.
- Impose a correspondence between the rectangle corners and screen corners.
- Use the correspondence to get a perspective transformation matrix.
- Apply ...
Get OpenCV Android Programming By Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.