Forum

Author Topic: Camera Centers not correct in certain projects  (Read 4501 times)

shwetankumar

  • Newbie
  • *
  • Posts: 20
    • View Profile
Camera Centers not correct in certain projects
« on: March 14, 2017, 05:58:54 PM »
Hi,

I ran a project through the Photoscan Professional and observed the following :

After successful dense point cloud generation, I exported the camera properties and got the standard xml file (attachment).
Each aligned image has a transformation object in the xml file.
1) I constructed a 4x4 matrix from the values (A).
2) Then I took the inverse of the above 4x4 matrix (A^-1).
3) The upper left 3x3 matrix of A^-1 was taken to be the rotation matrix R.
4) In the 4th column, the top 3 values were taken to be the translation column matrix t.
5) Using C = -Rt, I got the camera center C.
6) I plotted the 3D camera centers along with the point cloud and got the following model (attachment).

Can you help me figure out where I am going wrong ? The camera centers seem to be below the 3D structure.
Also attached is the view inside the Agisoft product.

Thanks,

Shwetank

« Last Edit: March 14, 2017, 06:02:08 PM by shwetankumar »

James

  • Hero Member
  • *****
  • Posts: 748
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #1 on: March 14, 2017, 06:43:19 PM »
Try negating the 2nd and 3rd rows of your inverted matrix:

http://www.agisoft.com/forum/index.php?topic=2351.msg12556#msg12556

Just an idea, i haven't had a chance to try it.

shwetankumar

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #2 on: March 14, 2017, 07:35:21 PM »
Hi James,

I tried what you suggested but it doesn't seem to give me the correct camera centers. Please look at the attached image (red are the original centers, green are the ones that I get after implementing your suggestion).
I would like to attach the point cloud file but the attachment limit prohibits that.

Thanks

James

  • Hero Member
  • *****
  • Posts: 748
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #3 on: March 14, 2017, 07:47:45 PM »
I can't help much - i'm more of a trial and error than deep understanding type...

If you do not yet have a mesh try creating a low detail one and then export it as .dae format including cameras.

You can then open the .dae file in a text editor and find the camera coordinates at the end of the file within <translate> elements inside the camera <node> elements.

JMR

  • Hero Member
  • *****
  • Posts: 502
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #4 on: March 15, 2017, 01:16:39 AM »
Just curious... why don't you export cameras in the simple way by means of export button in the ref panel?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #5 on: March 15, 2017, 01:28:12 AM »
Hello Shwetank,

How the dense cloud has been exported - is it in WGS84 coordinate system? If so, then you need to take into account the coordinate system in your approach.
Best regards,
Alexey Pasumansky,
Agisoft LLC

James

  • Hero Member
  • *****
  • Posts: 748
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #6 on: March 15, 2017, 01:10:33 PM »
Just curious... why don't you export cameras in the simple way by means of export button in the ref panel?

i like the way you think

shwetankumar

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #7 on: March 15, 2017, 05:03:10 PM »
The point cloud was exported in the local coordinate system (but the images had embedded GPS data).
I will try to re-run the project and repeat the steps after stripping out all the camera and GPS data to remove that variable.

Is there a chance that some internal transform is throwing my calculations off ?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #8 on: March 15, 2017, 05:25:23 PM »
Hello shwetankumar,

When you are exporting the data (mesh, dense cloud, for example) using Local Coordinates option for the georeferenced chunks, the result will be different from the coordinates in the internal coordinate system, actually, it will be in local system in the tangent coordinate system.  If you need to have the results of the camera positions and model in the same internal system, you need to reset transformation for the chunk before exporting mesh or point cloud.

Best regards,
Alexey Pasumansky,
Agisoft LLC

shwetankumar

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #9 on: March 15, 2017, 07:17:07 PM »
Thanks for that information Alexey !

Just to verify that I am doing the steps correctly,

If I have performed a 3D point cloud generation using geotagged images with exif data, I need to do the following if I export the point cloud in local coordinate system :

=>  Go to chunk properties, and select reset transform. Then export cameras and point cloud (in local coordinate system)

Following this, the camera centers should work based on my initial approach.

I really appreciate the prompt help.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #10 on: March 15, 2017, 07:21:38 PM »
Hello shwetankumar,

Yes, I think it should be the workflow. You can do it in the duplicated chunk, to avoid  loosing the georeferencing in the original chunk.

If you are using Python, you can reset transformation using chunk.transform = None line.

And I think that the process with the camera centers would be much easier without all those steps.
Best regards,
Alexey Pasumansky,
Agisoft LLC

shwetankumar

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #11 on: March 15, 2017, 11:26:30 PM »
Hi Alexey,

I tried what you suggested, and that worked for getting the cameras and the 3D point cloud in the same reference coordinate system. But, this led to loss of GPS scale data in the point cloud. (ResetTransformChurch.jpg - attachment)

Is there a way to do the above while keeping the GPS scale ?

What I am really trying to do it to scale the point cloud using the GPS data in the images, and get a scaled point cloud in meters (in local coordinate system). Then I want to overlay the cameras (with parameters expressed in same local coordinate system) for the GPS scaled point cloud.

It seems like I am missing some transform trick ... (which is in front of me somewhere but I can't find it)

Thanks !
« Last Edit: March 16, 2017, 01:34:38 AM by shwetankumar »

shwetankumar

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #12 on: March 16, 2017, 05:59:26 PM »
Hope this topic is not marked as solved yet    ???

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Camera Centers not correct in certain projects
« Reply #13 on: March 16, 2017, 06:41:20 PM »
Hello shwetankumar,

I can suggest to check the Export Cameras option in other from XML formats that allow to choose Local Coordinates option, such as Bundler, Boujou, CHAN, Omega-Phi-Kappa, for example.

Using only XML file you wouldn't be able to transform the camera positions from the internal system to the "local coordinates", since you need to have the information about the geographic coordinate system to build the tangential local coordinate system in the point of chunk origin.
Best regards,
Alexey Pasumansky,
Agisoft LLC