Agisoft Metashape > Python and Java API
Make a camera as the Photoscan model origin
j.seinturier:
Hello,
After the orientation of a set of photographs, i would like to set a specific photograph as the origin of the model referential (i would like that all points and photographs are expressed within the photograph referential).
Is it possible within Photoscan ? And more over, when does the model region get involved with transformations related to cameras / points ?
Thanks a lot,
Julien
Alexey Pasumansky:
Hello Julien,
You can do it in the following way:
--- Code: ---camera = chunk.cameras[10] #some random camera in the chunk that would be used as new system origin
m = PhotoScan.Matrix().Translation(-camera.center)
chunk.transform.matrix = chunk.transform.matrix * m
--- End code ---
After that in the new chunk internal system the coordinates of the camera.center would be (0, 0, 0):
--- Code: --->>> chunk.transform.matrix.mulp(camera.center)
Vector([0.0, 0.0, 0.0])
--- End code ---
j.seinturier:
Thanks Alexey.
I have few other questions:
1. When i'm exporting cameras orientation as Yaw, Pitch and roll, can you tell me what are the reference axis of each value ? Is there is a common referential ?
2. When i'm getting a camera transformation:
--- Code: ---m = camera.transform.matrix
--- End code ---
Is m is the transformation from world to camera or from camera to world ?
3. What are the chunk transformation and the region transformation ?
Thanks a lot,
Julien
Alexey Pasumansky:
Hello Julien,
In PhotoScan the following convention is used:
Yaw is a counterclockwise rotation around Z axis
Pitch is a clockwise rotation around X axis
Roll is a clockwise rotation around Y axis
R = Rz(-yaw) * Rx(pitch) * Ry(roll)
It comes to an accordance with the Wikipedia definition (https://en.wikipedia.org/wiki/Aircraft_principal_axes) in case the coordinate system related to the aircraft is defined in the following way:
Z axis pointing upwards,
X axis pointing to the right (to the right wing) ,
Y axis pointing forward (to the aircraft nose) .
camera.transform defines the conversion from the system related to the camera to the internal chunk's system. Also it can be said that this matrix defines the location of the camera center and camera orientation angle in the internal chunk's system.
chunk.transform.matrix performs the conversion from the internal chunk's system to geocentric coordinate system (if the chunk is georeferneced). In case the chunk is referenced in the local coordinates, then chunk.transform.matrix converts the coordinates to this particular local system directly.
As for the region parameters (region.rot, region.center and region.size) they define the orientation of the bounding box (as 3x3 matrix), box center and size of the box (as 3-component vector). All the values are in the internal chunk's system.
j.seinturier:
Thanks a lot Alexey,
But when i compare your answer to the aerial convention and to the Photoscan reference system, it semms that Z axis is pointing downwards, can you confirm that it was a typo or does the Z axis used for roll, pitch and yaw axis is well pointing upwards (that signify that the referential is indirect in this case).
Julien
Navigation
[0] Message Index
[#] Next page
Go to full version