opencv - How to find Camera matrix for Augmented Reality? -


i want augment virtual object @ x,y,z meters wrt camera. opencv has camera calibration functions don't understand how can give coordinates in meters

i tried simulating camera in unity don't expected result.

i set projection matrix follows , create unit cube @ z = 2.415 + 0.5 . 2.415 distance between eye , projection plane (pinhole camera model) since cube's face @ front clipping plane , it's dimension unit shouldn't cover whole viewport?

    matrix4x4 m = new matrix4x4();     m[0, 0] = 1;     m[0, 1] = 0;     m[0, 2] = 0;     m[0, 3] = 0;      m[1, 0] = 0;     m[1, 1] = 1;     m[1, 2] = 0;     m[1, 3] = 0;  m[2, 0] = 0;     m[2, 1] = 0;     m[2, 2] = -0.01f;     m[2, 3] = 0;      m[3, 0] = 0;     m[3, 1] = 0;     m[3, 2] = -2.415f;     m[3, 3] = 0; 

the global scale of calibration (i.e. units of measure of 3d space coordinates) determined geometry of calibration object use. example, when calibrate in opencv using images of flat checkerboard, inputs calibration procedure corresponding pairs (p, p) of 3d points p , images p, (x, y, z) coordinates of 3d points expressed in mm, cm, inches, miles, whatever, required size of target use (and optics images it), , 2d coordinates of images in pixels. output of calibration routine set of parameters (the components of projection matrix p , non-linear distortion parameters k) "convert" 3d coordinates expressed in metrical units pixels.

if don't know (or don't want use) actual dimensions of calibration target, can fudge them leave ratios unchanged (so that, example, square remains square though true length of side may unknown). in case calibration determined unknown global scale. common case: in virtual reality applications don't care global scale is, long results correct in image.

for example, if want add puffier pair of 3d lips on video of angelina jolie, , composite them original video brand new fake lips stay attached , "natural" on face, need rescale 3d model of fake lips overlaps correctly image of lips. whether model 1 yard or 1 mile away cg camera in render composite irrelevant.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -