Created
November 19, 2015 10:19
-
-
Save eprana/8abf86ebd324545dc3fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Retrieve pinhole from 'pinholeProjectionMatrix' attribute | |
| // Focal is the first element | |
| MDoubleArray intrinsicsArray; | |
| MVGMayaUtil::getDoubleArrayAttribute(camera.getDagPath().node(), "mvg_intrinsicParams", intrinsicsArray); | |
| LOG_INFO("mvg_intrinsicParams : ") | |
| LOG_INFO(intrinsicsArray) | |
| // Initialize K | |
| openMVG::Mat3 K; | |
| K(0,1) = 0.0; | |
| K(0,2) = 0.0; | |
| K(1,0) = 0.0; | |
| K(1,2) = 0.0; | |
| K(2,0) = 0.0; | |
| K(2,2) = 0.0; | |
| K(0,0) = intrinsicsArray[0]; | |
| K(1,1) = intrinsicsArray[0]; | |
| K(2,2) = 1.0; | |
| // First method : retrieve K and t | |
| MMatrix inclusiveMatrix = camera.getDagPath().inclusiveMatrix(); | |
| MTransformationMatrix transformMatrix(inclusiveMatrix); | |
| // Rotation matrix | |
| openMVG::Mat3 R; | |
| MMatrix rotationMatrix = transformMatrix.asRotateMatrix(); | |
| for(int i = 0; i < 3; ++i) | |
| { | |
| for(int j = 0; j < 3; ++j) | |
| R(i, j) = rotationMatrix[i][j]; | |
| } | |
| openMVG::Vec3 t; | |
| MVector translation = transformMatrix.translation(MSpace::kWorld); | |
| for(int i = 0; i < 3; ++i) | |
| t(i) = translation[i]; | |
| openMVG::Mat34 P; | |
| openMVG::P_From_KRt(K, R, t, &P); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mise à jour du code :