Understanding Homography in Computer Vision

Slide Note
Embed
Share

Homography is a fundamental concept in computer vision that involves mapping points from one plane to another. It helps in scenarios like image stitching and object recognition. This content covers the definition of homography, equations, practical examples, and tools for implementation such as MATLAB demos. Explore the importance of homography and its applications in transforming planar points between images.


Uploaded on Aug 23, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Homography KH wong Homography 220218a 1

  2. Introduction Map one set of planar 3D points to another plane Ref https://medium.com/all-things-about-robotics- and-computer-vision/homography-and-how-to- calculate-it-8abf3a13ddc5 https://www.uio.no/studier/emner/matnat/its/TEK5030/v1 9/lect/lecture_4_3-estimating-homographies-from- feature-correspondences.pdf Homography 220218a 2

  3. Define the problem H=homography, 2 examples x2 x1 A planar surface mapped to two images Homography 220218a 3

  4. Equation ?1 ?1 1 ?2 ?2 1 ?1 = , ?2 = x2 x1 1 4 7 2 5 8 3 6 9 Planar object Point X on Plane X H = ?1,?2 ??? ????????? ????? ????? in homogenous coordinates ? ?2 ? ?2 ? ?1 ?1 1 1 4 7 2 5 8 3 6 9 = , assume s=1 ?2= ?1* 1 + ?1 2 + 3 ?2= ?1* 4 + ?1 5 + 6 1= ?1* 7 + ?1 8 + 9 , rearrange terms, write in matrix form 0 ?1 ?2 ?1 ?2 ?1 ?2 ?2 ?1 1, 2, 3, 4, 5, 6, 7, 8, 9 =[ 0,0,0] 0 ?1 0 1 ?1 0 ?1 0 ?2 ?1 1 0 ?2 ?2 ?1 ?2 ?1 0 ?2 ?1 ?2 ?1 0 ?2 ?2 0 Homography 220218a 4

  5. Alternatively ?1 ?1 1 ?2 ?2 1 ?1 = , ?2 = x2 x1 11 21 31 12 22 32 13 23 33 Planar object Point X on Plane X H = ? ?2 ? ?2 ? ?1 ?1 1 1 4 7 2 5 8 3 6 9 ?1,?2 ??? ????????? ????? ????? in homogenous coordinates = Eliminate s, we can get ?(? ?) (9 1)= 0, for i=1,3,5,..N-1, total N feature points where 2 row pairs for each i are for i=1:2:N A(i,:)= [0 0 0 -u1(i) -v1(i) -1 v2(i)*u1(i) v2(i)*v1(i) v2(i)]; A(i+1,:)=[u1(i) v1(i) 1 0 0 0 -u2(i)*u1(i) -u2(i)*v1(i) -u2(i)]; end = 1, 2, 3, 4, 5, 6, 7, 8, 9? To recover u2,v2, use u2=(s*u2)/s and v2=(s*v2)/s Homography 220218a 5

  6. Demo1: Matlab test (assume no noise) for noisy images, use https://www.mathworks.com/matlabcentral/fi leexchange/28760-2d-2d-projective- homography-3x3-estimation %homography, khw 2022.2.18, assume no noise, for noisy images %for noisy images, use https://www.mathworks.com/matlabcentral/fileexchange/28760-2d-2d-projective-homography-3x3-estimation function homography_demo() % https://www.uio.no/studier/emner/matnat/its/TEK5030/v19/lect/lecture_4_3-estimating-homographies-from-feature-correspondences.pdf clc close all clear pwm=5*(10^-6) %5um = Pixel Width in Meter %pwm=1; f=1000; %focal length in pixel anx=20*pi/180,any=10*pi/180,anz=8*pi/180 %extrsinc cam rotation , in radian T1=[0,0,0]'/pwm; %T1 is at reference position T2=[0.005, 0.01, 0.0025]'/pwm; %a 3D plane projected to two images ox=1000;oy=1000; kint=[f 0 ox; 0 f oy ; 0 0 1];%intrinsic cam parameters R1=rpyMat([0,0,0]); %R1 is at reference position R2=rpyMat([anx,any,anz]); kext1=[R1 T1] kext2=[R2 T2] %%% gen 3D points N=10 zz=0.6; %Z depth of the obejct center Homography 220218a 6 obj=[rand(2,N);zeros(1,N)] +repmat([0,0,zz]',1,N);%plannar,centered(0,0,zz) %obj=[rand(3,N)] +repmat([0,0,zz]',1,N) ;% non-plannar; not for homography

  7. Application: merge 2 images Take 2 images of a planar surface from different views, some parts are overlapped An example of Point-correspondence Step1: Find 4 or more point-correspondences (use sift or hand click) between image 1 and 2 Step2: find H Step3: map (wrap) image2 to image 1 coordinates using H and merge them Warp image using H Homography 220218a 7

  8. Demo2 http://www.cse.cuhk.edu.hk/~khwong/www2/cmsc5711/homography_file_x2.zip see readme inside for user manual Homography H Image 1 are2 are taken by user Use image1 and image2 to find Homography H [su2;sv2;s]=H*[u1,v1,1] Blue points are mapped to red points Mapped from pixels of image 1 by H*[u1;v1;1] Inspection: image 3 is similar to image2 Image 1:Pixels are [u1;v1] Image2: Pixels are [u2;v2] H*[u1;v1;1] Image3: mapped from image1 Homography 220218a 8

  9. Conclusion Studied the basic principle of plane-to-plane homography mapping Studied a program that can achieve homography mapping Homography 220218a 9

Related


More Related Content