300 likes | 426 Views
CMPUT 412 3D Computer Vision. Presented by Azad Shademan Feb. 13-15, 2007. Acknowledgement . Marc Pollefeys’ slides (University of North Carolina), comp290-89 Spring 2003 http://www.cs.unc.edu/~marc/mvg/slides.html. Motivation.
E N D
CMPUT 412 3D Computer Vision Presented by Azad Shademan Feb. 13-15, 2007
Acknowledgement • Marc Pollefeys’ slides (University of North Carolina), comp290-89 Spring 2003 http://www.cs.unc.edu/~marc/mvg/slides.html
Motivation • Images form one of the most important feedback signals in robotics. • Vision-based control: • Robotic Visual Servoing • Mobile Navigation
More motivation • Course project: • Two cameras looking at one scene • Need to “correspond” similar points in these two images Laser projection on the wall Image plane Right camera Image plane Left camera
Camera Model Mostly pinhole camera model
Principle Point Offset principal point
Principle Point Offset calibration matrix
Hierarchy of transformations Projective 15dof Intersection and tangency Parallellism of planes, Volume ratios, centroids Affine 12dof Similarity 7dof Euclidean 6dof Volume
Camera Calibration • Procedure that finds the camera matrix, i.e., • Intrinsic camera parameters • Extrinsic camera parameters • Rotation • Orientation • There is a lot to be done with calibrated cameras, BUT we are more interested in uncalibrated cameras (more challenging)
Some linear algebra to get started • Singular value decomposition (SVD) • Decomposes a matrix as follows:
Singular Value Decomposition • Homogeneous least-squares • Span and null-space • Closest rank r approximation • Pseudo inverse
Parameter estimation • 2D homography Given a set of (xi,xi’), compute H (xi’=Hxi) • 3D to 2D camera projection Given a set of (Xi,xi), compute P (xi=PXi) • Fundamental matrix Given a set of (xi,xi’), compute F (xi’TFxi=0)
Number of measurements required • At least as many independent equations as degrees of freedom required • Example: 2 independent equations / point 8 degrees of freedom 4x2≥8
Approximate solutions • Minimal solution 4 points yield an exact solution for H • More points • No exact solution, because measurements are inexact (“noise”) • Search for “best” according to some cost function • Algebraic or geometric/statistical cost
Direct Linear Transformation(DLT) • Equations are linear in h • Only 2 out of 3 are linearly independent (indeed, 2 eq/pt) (only drop third row if wi’≠0) • Holds for any homogeneous representation, e.g. (xi’,yi’,1)
Direct Linear Transformation(DLT) • Solving for H size A is 8x9 or 12x9, but rank 8 Trivial solution is h=09T is not interesting 1-D null-space yields solution of interest pick for example the one with
Direct Linear Transformation(DLT) • Over-determined solution No exact solution because of inexact measurement i.e. “noise” • Find approximate solution • Additional constraint needed to avoid 0, e.g. • not possible, so minimize
DLT algorithm • Objective • Given n≥4 2D to 2D point correspondences {xi↔xi’}, determine the 2D homography matrix H such that xi’=Hxi • Algorithm • For each correspondence xi ↔xi’ compute Ai. Usually only two first rows needed. • Assemble n 2x9 matrices Ai into a single 2nx9 matrix A • Obtain SVD of A. Solution for h is last column of V • Determine H from h
Normalized DLT algorithm • Objective • Given n≥4 2D to 2D point correspondences {xi↔xi’}, determine the 2D homography matrix H such that xi’=Hxi • Algorithm • Normalize points • Apply DLT algorithm to • Denormalize solution
OpenCV • cvFindHomography() • cvFindFundamentalMat() • …
cvFindHomography Finds perspective transformation between two planes void cvFindHomography( const CvMat* src_points, const CvMat* dst_points, CvMat* homography ); src_points Point coordinates in the original plane, 2xN, Nx2, 3xN or Nx3 array (the latter two are for representation in homogeneous coordinates), where N is the number of points. dst_points Point coordinates in the destination plane, 2xN, Nx2, 3xN or Nx3 array (the latter two are for representation in homogeneous coordinates) homography Output 3x3 homography matrix. The function cvFindHomography finds perspective transformation H=||hij|| between the source and the destination planes: [x',,i,,] [x,,i,,] s,,i,,[y',,i,,]~H*[y,,i,,] [1 ] [ 1] So that the back-projection error is minimized: sum_i((x',,i,,-(h11*x,,i,, + h12*y,,i,, + h13)/(h31*x,,i,, + h32*y,,i,, + h33))^2^+ (y',,i,,-(h21*x,,i,, + h22*y,,i,, + h23)/(h31*x,,i,, + h32*y,,i,, + h33))^2^) -> min The function is used to find initial intrinsic and extrinsic matrices. Homography matrix is determined up to a scale, thus it is normalized to make h33=1.