The homography matrix H is a 3×3 transformation that maps points from one camera plane to another, computed by finding corresponding points between two images and solving a system of linear equations using Singular Value Decomposition (SVD), where four point correspondences provide eight equations to determine the eight degrees of freedom in the matrix.
Homography in Computer Vision: SVD & RANSAC Explained
Added:hi in this tutorial I'm gonna talk about the tomography ma graffia projection between 3d to 2d or between 2d in one camera to the other camera so I'm gonna write down some equation and also some drawing for the model okay imagine this is uh this is a plane and we got a couple of points on there and this is the center of projection for your first camera and this is a camera that you get here and this is your coordinate system and it's another camera plane and central projection for second camera okay now imagine we got some points here on this plane so they all could be fitted on the plane and all these points are being projected into both cameras so we just drew a line through the center of projection and you will get for instance these points and a camera plane and it's just same for a second camera and you will get these points okay so if you remember from the camera calibration you can find a position of this point and the camera plane with multiplication of the point position in the world coordinate system multiple by M of extrinsic which basically these matrix express the poles that are in this frame into this frame and then multiplication by M of I am or for interesting parameters which when you compute this point the camera plane you know this is your sensor or camera plane and this is this is the camera central projection so this 0 0 for a camera plane is here well the 0 0 is here for in this frame so you know you have to do some rotation and translation so you shift it from here to here and also you you scales here in this frame are based on the meters but here you have some pixels so you have to multiply it by you know you know you have to know the scale ratio in both an x and y directions by you have to know how many pixel per meter you have so if you here I don't know 10 millimeter you have to go an X 2 or Y direction you have to multiply by pixel by meter so you have to know how many pixels you have to go in the sensory plate or a camera plane because here is a matrix and here's a frame okay so I can multiply these two to get the point in the camera plane it's it's basically four by four matrix you know it's a three by three rotation and a three by one translation plus this interesting matrix so basically you have this matrix I will write it down here okay thanks why if they love you is equal to 1 1 1 2 3 4 then 2 1 2 2 3 okay but we know that the war coordinate system is something that we defined so if we put a war coordinate system here in this plane and this is Z as the original disease upward if you put the world coordinate here actually the Z for all this point is zero so it's gonna be X y 0 W and you can see every time I multiply this where it is always multiply this area by zero this by zero display zero so I can totally omit it and I will get a three by three matrix instead which I won't call the age so I'm gonna have X Y W go to page not to pull by thanks okay so this is three by three matrix which relate points in the world coordinate to chemically okay how can we find H I will tell you in a second but before that let's see if you can find a position what camera in another camera okay as you can okay this h is invertible means you can always multiply by H inverse and get the pose from camera from to the ward okay I will try multiple both side by inverse I will get I will get this part point in the world coordinate system and if I let me just call it h1 for camera one and again if I multiply these by h2 I will get it in the second camera so it's just write down x y y if I just multiplied in my inverse of age I will get this okay and then if I multiple this by age two I will get X 2 y 2 okay so that's how I can relate this point to each other but the first then the next step is how we can actually find h1 and h2 ok to do that let's write down some equation and expand these terms okay so let us start with this matrix first X 2 y 2 and W 2 equal to h1 1 H 1 2 3 and you know that when you multiply these two matrix together we can always write it down as a another homography called H because it's 3 by 3 multiplied by 3 by trees and other 3 by 3 matrix so h2 - sorry H - 1 h2 to H 2 H 3 1 3 X 1 y 1 and W 1 so and you know that these are linear and homogeneous coordinates so if when I get D in a homogeneous coordinate I just have to multiply it by the scale factor which is w so I call the prime X Prime 2 is equal X 2 over W 2 and y Prime 2 is equal Y 2 or T W 2 okay what is uh what is it uh W that will use this term multiple my we struggle to by this column okay so let's write it down X prime X 1 plus h 1 2 y 1 plus h 1 3 W 1 and W 2 is H 3 1 X 1 plus h 3 2 y 1 plus h 3 3 now when you want and lifetime 2 and is equal to each age to age [Music] okay so we know that these W or our actual are some scale factors and we can this is something that you can define and if it D we find them one can get rid of W so we just the devil equal to one and remember we're looking for H we multiply these Spidey's and we set the W 1 and we subtract it from this L to get this arrival write it down here quickly so X prime to X 1 H 3 1 plus X prime to just write it down and then we'll give equal to 1 X prime to one h3o plus X Prime 2 H 3 3 thanks to H 1 okay so I just put a W equal to 0 to 1 and then I multiplied this server by this 7 subtract it by the denominator same for second equation - the nominator edge - okay so this mattress is actually three by three but you know we can always define the we can always set the W and H 3 1 such that you're always divided by that and get rid of this last term so we did the degree of freedom for this matrix is actually 8 so if we could find four points in our work coordinate system here in fact if we could find four corresponding point meaning that we know exactly what is the position of these points and we could correctly identify them in both frames and boosts image plane we could plot them into this formula write down eight equations the one equation 2 equation for each point and then we put it in a matrix form and we use the singular value decomposition to find the value for H okay let me just write it down again I'm looking for H so I'm trying to decouple this into two matrixes one for age and one for the other variables so it's gonna be something like long matrix like this 9x1 h-11 h-12 up to H 3 3 okay and the other side is 0 and if you have a look at this for instance the first equation I can't write it down as minus x1 minus y1 minus 1 0 0 0 X 1 X 2 prime X 2 prime Y 1 and X 2 Prime basic I just saw decouple these into two matrix you can just check out this multiplication by this should give you this equation and for a second equation have 0 of 0 0 okay so that was for a for one point if you write it down for four points you will get eight equation here and this is a homogeneous equation that means and the other the other side is zero Lissa's course of solvent because elisacorral B was in the form of a x1 equal to B and you multiply it by the inverse or pseudo inverse of a so in this case you have to use a singular value decomposition you have to use the SVD and the last columns of D is the H matrix that we are looking for you can have a look on my website for the more details on the code I have done it in MATLAB you can have a look in the example I provided there and yeah that that was it for fighting the mammography
Up Next

Computing FFT and Plotting Frequency Spectrum in Python with NumPy and Matplotlib
@1mviews876
120.4K views•2020-11-08

Homogeneous Coordinates in Robotics | Cyrill Stachniss Lecture
@CyrillStachniss
80.8K views•2013-10-22

HTTP Requests Explained: GET, POST, PUT, DELETE
@codecademy
103.1K views•2021-10-07

Enigma Machine Mechanics: WWII Encryption Explained
@JaredOwen
13.2M views•2021-12-11
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Computer Science




![Basics of Linear Algebra for AI and ML [with code]: Part 1](https://i.ytimg.com/vi_webp/N1Pvj4CZT1M/maxresdefault.webp)






![OpenCV Computer Vision Application Programming [Video Course]](https://i.ytimg.com/vi_webp/DB5bJ5LkN0U/maxresdefault.webp)






















