camera positions and poses from bin file not aligning with meshed.ply

1,595 views
Skip to first unread message

Deepak R

unread,
Jan 18, 2018, 10:03:17 PM1/18/18
to COLMAP


I am trying to take the camera position and pose output (as seen in the screenshot) from the images.bin file and overlay it on the dense reconstructed mesh file. I imported the mesh file using VTK library and plotted the camera positions (white spheres in the image with green background) in the visualizer window.




Why are the cameras and the model not aligned like the output of the sparse reconstruction? The camera positions seems to be way off from what is expected. Am I doing the right thing in using the images.bin file for getting the camera position and orientation?






Johannes Schönberger

unread,
Jan 18, 2018, 10:42:06 PM1/18/18
to col...@googlegroups.com
You are probably visualizing R and T directly, which defines the projection matrix from world to camera system. Instead you need to compute C = -R^t * T (where ^t is the transpose and C the camera center).

> On Jan 18, 2018, at 7:03 PM, Deepak R <iam...@gmail.com> wrote:
>
>
>
> I am trying to take the camera position and pose output (as seen in the screenshot) from the images.bin file and overlay it on the dense reconstructed mesh file. I imported the mesh file using VTK library and plotted the camera positions (white spheres in the image with green background) in the visualizer window.
>
>
>
>
>
>
>
>
>
> Why are the cameras and the model not aligned like the output of the sparse reconstruction? The camera positions seems to be way off from what is expected. Am I doing the right thing in using the images.bin file for getting the camera position and orientation?
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "COLMAP" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to colmap+un...@googlegroups.com.
> To post to this group, send email to col...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/colmap/b08bdb69-388c-4c9d-b261-23376cf6cddc%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Deepak R

unread,
Jan 19, 2018, 12:18:25 AM1/19/18
to COLMAP

Sorry I did not understand your reply. I am looking to visualize the camera position and orientation in world coordinates. If C is the camera center, where do I get the R matrix? and what is T?
The information I read from the binary file is as below picture. My understanding is  qw,qx,qy,qz is a orientation quaternion and tx,ty,tz is the position vector of the camera that took the image. Is this right? How do I use the image information to get the camera position and orientation?

Auto Generated Inline Image 1

Johannes Schönberger

unread,
Jan 19, 2018, 1:25:23 AM1/19/18
to col...@googlegroups.com
Invert the rotation (either directly the quaternion or convert it to a rotation matrix R). Then compute the camera center as -R^t * T (here R^t is the inverse rotation of R which is defined by the quaternion).

Best,
Johannes

> On Jan 18, 2018, at 9:18 PM, Deepak R <iam...@gmail.com> wrote:
>
>
> Sorry I did not understand your reply. I am looking to visualize the camera position and orientation in world coordinates. If C is the camera center, where do I get the R matrix? and what is T?
> The information I read from the binary file is as below picture. My understanding is qw,qx,qy,qz is a orientation quaternion and tx,ty,tz is the position vector of the camera that took the image. Is this right? How do I use the image information to get the camera position and orientation?
>
> <Auto Generated Inline Image 1.png>
>
>
> On Friday, January 19, 2018 at 2:42:06 PM UTC+11, Johannes Schönberger wrote:
> You are probably visualizing R and T directly, which defines the projection matrix from world to camera system. Instead you need to compute C = -R^t * T (where ^t is the transpose and C the camera center).
>
> > On Jan 18, 2018, at 7:03 PM, Deepak R <iam...@gmail.com> wrote:
> >
> >
> >
> > I am trying to take the camera position and pose output (as seen in the screenshot) from the images.bin file and overlay it on the dense reconstructed mesh file. I imported the mesh file using VTK library and plotted the camera positions (white spheres in the image with green background) in the visualizer window.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Why are the cameras and the model not aligned like the output of the sparse reconstruction? The camera positions seems to be way off from what is expected. Am I doing the right thing in using the images.bin file for getting the camera position and orientation?
> >
> >
> >
> >
> >
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "COLMAP" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to colmap+un...@googlegroups.com.
> > To post to this group, send email to col...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/colmap/b08bdb69-388c-4c9d-b261-23376cf6cddc%40googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "COLMAP" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to colmap+un...@googlegroups.com.
> To post to this group, send email to col...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/colmap/3f563415-6a6d-4be6-8d46-e07cc71847e6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <Auto Generated Inline Image 1.png>

Deepak R

unread,
Jan 19, 2018, 8:40:49 AM1/19/18
to COLMAP
Thanks a lot, I am able to get the camera center according to the formula and the it seems to be right. So what would be the orientation of the camera's principal axis?

Johannes Schönberger

unread,
Jan 19, 2018, 12:08:17 PM1/19/18
to col...@googlegroups.com
The local camera coordinate system is X to the right, Y to the down, Z to the front (when looking from the camera's perspective). So, the viewing the direction in the local camera coordinate system is [0 0 1], to bring it to the global system you have to calculate R^t * [0 0 1] or just extract the third row of R.

Cheers,
Johannes
> To view this discussion on the web visit https://groups.google.com/d/msgid/colmap/cc63f6b2-6a53-4ed9-834c-1b0f54684d36%40googlegroups.com.

adamhe...@gmail.com

unread,
Mar 16, 2018, 12:02:01 PM3/16/18
to COLMAP
Hi Deepak, 

Can you help me understand how you solved this? What equation do I need to get the inverse rotation from the quaternion (qw, qx, qy, qz)?

Johannes Schönberger

unread,
Mar 21, 2018, 12:06:11 PM3/21/18
to COLMAP
Reply all
Reply to author
Forward
0 new messages