Agisoft Metashape
Agisoft Metashape => General => Topic started by: shwetankumar 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
-
Try negating the 2nd and 3rd rows of your inverted matrix:
http://www.agisoft.com/forum/index.php?topic=2351.msg12556#msg12556 (http://www.agisoft.com/forum/index.php?topic=2351.msg12556#msg12556)
Just an idea, i haven't had a chance to try it.
-
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
-
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.
-
Just curious... why don't you export cameras in the simple way by means of export button in the ref panel?
-
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.
-
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
-
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 ?
-
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.
-
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.
-
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.
-
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 !
-
Hope this topic is not marked as solved yet ???
-
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.