Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Question about camera.sfm poses #655

Closed
simoneBrancati opened this issue Sep 24, 2019 · 7 comments
Closed

[question] Question about camera.sfm poses #655

simoneBrancati opened this issue Sep 24, 2019 · 7 comments

Comments

@simoneBrancati
Copy link

simoneBrancati commented Sep 24, 2019

Describe the problem
After the completion of StructureFromMotion node a camera.sfm file is produced.
Inside this file all the views' instrics and extrinsics are listed. In particular, under the "poses" keyword we find the views' poses.
For example:

poses": [
        {
            "poseId": "300639444",
            "pose": {
                "transform": {
                    "rotation": [
                        "0.99995348941947282",
                        "-0.00057462984792917393",
                        "0.0096275021868713097",
                        "0.00061704033357770128",
                        "0.99999011748701916",
                        "-0.0044027479515035455",
                        "-0.0096248770925701308",
                        "0.004408483734301312",
                        "0.99994396193592638"
                    ],
                    "center": [
                        "-0.011947754013339834",
                        "0.010463514098481298",
                        "0.023576133686596487"
                    ]
                },
                "locked": "0"
            }
        }

Questions:

  • Does rotation refers to a 3 x 3 rotation matrix and center to the translation vector.
  • in what order i should put the elements of this rotation to create a rotation matrix (i.e. the OpenGL ModelView matrix?)
  • what is the scale of this pose calculation (does meshroom approximates the scale of the real world object somehow)?
@simogasp
Copy link
Member

simogasp commented Sep 24, 2019

Does rotation refers to a 3 x 3 rotation matrix and center to the translation vector.

The rotation is the 3x3 rotation and center is the camera center C in world coordinates. So a point Q in world coordinates projects into the camera as

q ~ K [R -RC] Q

in what order i should put the elements of this rotation to create a rotation matrix (i.e. the OpenGL ModelView matrix?)

That's a column-major Eigen matrix, so the first 3 elements are the first column of the matrix and so on. Incidentally, both OpenGL and Eigen use column-major format for storing matrices, so if you read and store the values in the that order in a raw buffer you can use it as a matrix in opengl.

what is the scale of this pose calculation (does meshroom approximates the scale of the real world object somehow)?

The scale is always arbitrary, reconstruction is always up to a scale factor. In order to bring it in the real world scale, you need to know some relationship (e.g. the distance between two points) and rescale the scene (points and cameras) accordingly.

@simoneBrancati
Copy link
Author

simoneBrancati commented Sep 24, 2019

Thanks a lot!
If i know the real object dimensions, is there any input parameter in the pipeline i can put in to adjust the scale?

@fabiencastan
Copy link
Member

In the SfMTransform, you can use "auto_from_landmark" which will fit a box around your 3D points and rescale it to -scale to +scale. But if you have points reconstructed around your object, it will become completely wrong.

Another solution, is to put markers, and rescale your scene based on these markers, but that's in development here: #652.

@yzslab
Copy link

yzslab commented Jun 30, 2022

Does rotation refers to a 3 x 3 rotation matrix and center to the translation vector.

The rotation is the 3x3 rotation and center is the camera center C in world coordinates. So a point Q in world coordinates projects into the camera as

q ~ K [R -RC] Q

in what order i should put the elements of this rotation to create a rotation matrix (i.e. the OpenGL ModelView matrix?)

That's a column-major Eigen matrix, so the first 3 elements are the first column of the matrix and so on. Incidentally, both OpenGL and Eigen use column-major format for storing matrices, so if you read and store the values in the that order in a raw buffer you can use it as a matrix in opengl.

what is the scale of this pose calculation (does meshroom approximates the scale of the real world object somehow)?

The scale is always arbitrary, reconstruction is always up to a scale factor. In order to bring it in the real world scale, you need to know some relationship (e.g. the distance between two points) and rescale the scene (points and cameras) accordingly.

@simogasp Hi, would you mind telling me what is the meaning of the K in q ~ K [R -RC] Q ? Thanks.

@simogasp
Copy link
Member

K is the 3x3 calibration matrix that contains the intrinsic parameters of the camera, like the focal length and the principal point.
https://en.wikipedia.org/wiki/Camera_resectioning#Intrinsic_parameters

@yzslab
Copy link

yzslab commented Jul 1, 2022

K is the 3x3 calibration matrix that contains the intrinsic parameters of the camera, like the focal length and the principal point. https://en.wikipedia.org/wiki/Camera_resectioning#Intrinsic_parameters

wow, thanks for your detailed explaination!

@rinki447
Copy link

is there any unit for the camera centre under poses? I mean the centre can be located 3mm or 3 meter away from world origin. How to know?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants