Summary of steps
- Removing perspective
Install required packages
sudo apt install g++ cmake libeigen3-dev make libopencv-dev
Create a directory for todays lab
mkdir -p ~/04-04/code
Download template code
homography.cppand save to
data/removing-perspective-distortion.pngand save to
mkdir -p ~/04-04/code/build cd ~/04-04/code/build cmake .. make
Once you run the following command, a window with image will show up.
cd ~/04-04/code/build ./homography ../data/removing-perspective-distortion.png
Left click on marked points in the following order left top, left bottom, right top, right bottom. Then press any key to quit. This will record the coordinates of the marked points. In general you can chose to click on any rectangular thing in the image. Bigger the rectangular thing, better is the H estimation.
Fill in correct formulas
homography.cpp with correct formula from the exam or 03/25 lecture.
Once you fill in everything right, you should see this as the final image:
Submit the homography.cpp file
Get a picture with perspective effect
Note that we do not need camera calibration matrix to complete this process.
Click a picture of the lab so that windows or cupboards or any other rectangular object appears with a perspective effect (using any camera mobile or laptop). Perspective effect is when parallel lines in the 3D world are not parallel, instead converging in the image.
Somehow (by emailing it to yourself?) get the image to the linux and save the image as
Repeat the process to remove distortion. Submit the screenshot of image with and without perspective effect.