The First Part of the code consists of a pipeline to detect the page corners in a video frame. The Second Part of the code is stitching an image taken from different perspectives using Homography Calculation and Warp Perspective
For Corner Detection the Video can be found at here
- Read the video and extract individual frames using OpenCV.
- Skip blurry frames (use Variance of the Laplacian and decide a suitable threshold) Note: Any value below 150 for the Variance of the Laplacian, suggests that it’s a blurry image.
- Segment out the unwanted background area (example: convert to gray scale and keep white regions)
- Detect edges pixels in each frame using Canny Edge Detector
- Use the detected edge pixels to extract straight lines in each frame (hint: use Hough Transform)
- Filter out “short” lines and only keep a few dominant lines.
- Compute the intersections of the Hough Lines – these are the putative corners of the paper.
- Verify the existence of those corners with Harris corner detector. (use OpenCV built-in function)
- Filter out remaining extraneous corners that are not the 4 corners of the paper.
- Generate the output video in which you have to overlay the 4 blue boundary lines and 4 red corners of the paperin each frame (excluding the blurry frames)
For Image Stitching the Images can be found here