OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Tue, 04 Feb 2014 03:14:46 -0600Construction of Camera matrixhttp://answers.opencv.org/question/27644/construction-of-camera-matrix/Dear All, Here is a simple problem
P=[-306.8843; -263.0437; 0] is a point in space and
p = [ 447.3374 ; 487.9971] is a corresponding image observation in pixels.
If 149.2, -53.6, -56.2 are Euler angles about x, y and z axis respectively,
T= [ -28.3; -10.4; 1794.3 ] is translation vector,
f= 16.5621 is the focal length,
c=[ 285.7615; 249.037 ] are coordinate of principal points
and aspect ratio is 1
How to construct camera matrix, that give p=[C] * P
Your help will be greatly acknowledged
ThanksMon, 03 Feb 2014 11:19:11 -0600http://answers.opencv.org/question/27644/construction-of-camera-matrix/Comment by jensenb for <p>Dear All, Here is a simple problem</p>
<p>P=[-306.8843; -263.0437; 0] is a point in space and
p = [ 447.3374 ; 487.9971] is a corresponding image observation in pixels.</p>
<p>If 149.2, -53.6, -56.2 are Euler angles about x, y and z axis respectively,
T= [ -28.3; -10.4; 1794.3 ] is translation vector,
f= 16.5621 is the focal length,
c=[ 285.7615; 249.037 ] are coordinate of principal points
and aspect ratio is 1</p>
<p>How to construct camera matrix, that give p=[C] * P </p>
<p>Your help will be greatly acknowledged </p>
<p>Thanks</p>
http://answers.opencv.org/question/27644/construction-of-camera-matrix/?comment=27668#post-id-27668You can construct the camera (projection) matrix using the rotation, translation, focal lengths and principle points. You do not need a 3d - 2d point correspondence in this case.Tue, 04 Feb 2014 03:14:46 -0600http://answers.opencv.org/question/27644/construction-of-camera-matrix/?comment=27668#post-id-27668Answer by JohannesZ for <p>Dear All, Here is a simple problem</p>
<p>P=[-306.8843; -263.0437; 0] is a point in space and
p = [ 447.3374 ; 487.9971] is a corresponding image observation in pixels.</p>
<p>If 149.2, -53.6, -56.2 are Euler angles about x, y and z axis respectively,
T= [ -28.3; -10.4; 1794.3 ] is translation vector,
f= 16.5621 is the focal length,
c=[ 285.7615; 249.037 ] are coordinate of principal points
and aspect ratio is 1</p>
<p>How to construct camera matrix, that give p=[C] * P </p>
<p>Your help will be greatly acknowledged </p>
<p>Thanks</p>
http://answers.opencv.org/question/27644/construction-of-camera-matrix/?answer=27663#post-id-27663Your three euler angles and T are describing the rigid motion from the 3d point of your object coordinate system to a 3d point in the camera coordinate system (Pc):
Pc = [R,t] * P;
You have to use a camera model, for example Zhang. Then, Pc will be projected on the normalized image plane (division by the Z-Components) and corrected with the distortion parameters (radial and tangential).
pc = Pc/Z;
The final step is your point in the image coordinate system of your image plane:
p = K * pc;
K includes four parameters, fx fy and cx, cy (assuming you have square pixels on your sensor).
You should have a look in the book of Trucco & Verri or the doc:
http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html
Tue, 04 Feb 2014 02:12:13 -0600http://answers.opencv.org/question/27644/construction-of-camera-matrix/?answer=27663#post-id-27663Comment by jensenb for <p>Your three euler angles and T are describing the rigid motion from the 3d point of your object coordinate system to a 3d point in the camera coordinate system (Pc):</p>
<p>Pc = [R,t] * P;</p>
<p>You have to use a camera model, for example Zhang. Then, Pc will be projected on the normalized image plane (division by the Z-Components) and corrected with the distortion parameters (radial and tangential). </p>
<p>pc = Pc/Z;</p>
<p>The final step is your point in the image coordinate system of your image plane:</p>
<p>p = K * pc;</p>
<p>K includes four parameters, fx fy and cx, cy (assuming you have square pixels on your sensor).</p>
<p>You should have a look in the book of Trucco & Verri or the doc:</p>
<p><a href="http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html">http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html</a></p>
http://answers.opencv.org/question/27644/construction-of-camera-matrix/?comment=27667#post-id-27667I would note that assuming a general pinhole camera model (I am unaware of any Zhang camera model), there is no need to separate the extrinsic and intrinsic steps in the projection and you not need to normalize (unless performing distortion removal, which was not asked). In general you can formulate it as p = [K] [R | t] [P 1], where K is the calibration matrix, R = RxRyRz the composition of the eurler angle matrices, and t the translation.Tue, 04 Feb 2014 03:08:45 -0600http://answers.opencv.org/question/27644/construction-of-camera-matrix/?comment=27667#post-id-27667