Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: gerg on March 17, 2017, 04:37:42 PM

Title: Rotating a georeferenced model
Post by: gerg on March 17, 2017, 04:37:42 PM
Hey all,

I'm trying to rotate a georeferenced model so that it is in a specific orientation when exported. When I do even simple rotations (like 90 degrees about Z axis, for example) I end up with a bizarre rotation. As a sanity check, I have used the same exact script to rotate a non-georeferenced model, and I had no problem doing exactly what I want.

Is there a secondary matrix for georeferenced models that I also need to refer to when trying to do this rotation? Like one that changes from local coordinates to absolute coordinate?

Example for yaw 90 degrees:

...
T = PhotoScan.Matrix( [[0,-1,0,0],
                         [1,0,0,0],
                         [0,0,1,0],
                         [0,0,0,1]]);
chunk.transform.matrix = chunk.transform.matrix * T
...

Many thanks,

Greg
Title: Re: Rotating a georeferenced model
Post by: gerg on March 20, 2017, 11:00:42 PM
In addition, how do you manipulate position in local coordinates of a geo-referenced model? I'm trying to have the model origin in local coordinates be the centroid of the model, but I'm running into a lot of trouble.
Title: Re: Rotating a georeferenced model
Post by: Alexey Pasumansky on March 21, 2017, 11:16:53 AM
Hello Greg,

Which task you are trying to solve? Do you need to rotate the model for the export only?
Title: Re: Rotating a georeferenced model
Post by: gerg on March 21, 2017, 04:10:20 PM
Hi Alexey,

My goal is to take a geo-referenced model that I've already built, set the model origin to the centroid, and perform a few simple rotations (trying to get +X North, +Y East, +Z Down). Then, I want to export an obj in local coordinates (meters), and a kmz file. I would like to be able to later extract the kml file to geo-reference the obj.

I've succeeded in doing this transformations for non-geo-referenced models, but I believe the geo-referencing is causing some issues.

Thanks,

Greg
Title: Re: Rotating a georeferenced model
Post by: mwillis on March 24, 2017, 08:33:58 PM
I also need to rotate georeferenced models.  This used to be supported in Photoscan, several version ago.  I use my older build of Photoscan on those projects that need rotation.  It would be great if this functionality came back.