Skip to content

tprigent/image-homography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Homography on image

This simple code has been developed during the PIV (Image Processing) course @IST Lisboa.

The aim is to determine the homography between a sheet distorted by perspective and a view from above. The homography is determined manually, without using OpenCV. However, OpenCV is used for display purposes and to apply the homography once determined.

Algorithm

The first part consists in getting the 4 key points of the sheet. These coordinates will be considered as being part of the initial picture frame.

Then, we declare our final frame, by choosing the size of the input image (example here, should fit the sheet format). Hence, the sheet will fill the entire output image.

The mathematical part follows. We build the correpondance point matrix $A$ for each point as below:

A matrix

Then, the homography h is given by solving $Ah=0$. The SVD algorithm is then used to get the result (the last column of V gives the best result). We get the desired form H by reshaping $h$ to a $3x3$ matrix.

OpenCV is again used to apply the homography, and write the output image.

Results

The 4 points have been places at the 4 corners of the iPad, here is the result:

Input image Output image
Image res-Image

About

Implementation of an homography algorithm for computer vision

Topics

Resources

Stars

Watchers

Forks

Languages