Forum

Author Topic: Make a camera as the Photoscan model origin  (Read 5567 times)

j.seinturier

  • Newbie
  • *
  • Posts: 19
    • View Profile
Make a camera as the Photoscan model origin
« on: January 05, 2018, 12:51:45 PM »
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

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15173
    • View Profile
Re: Make a camera as the Photoscan model origin
« Reply #1 on: January 05, 2018, 06:29:56 PM »
Hello Julien,

You can do it in the following way:

Code: [Select]
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

After that in the new chunk internal system the coordinates of the camera.center would be (0, 0, 0):
Code: [Select]
>>> chunk.transform.matrix.mulp(camera.center)
Vector([0.0, 0.0, 0.0])
Best regards,
Alexey Pasumansky,
Agisoft LLC

j.seinturier

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Make a camera as the Photoscan model origin
« Reply #2 on: January 06, 2018, 08:14:18 PM »
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: [Select]
m = camera.transform.matrix

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

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15173
    • View Profile
Re: Make a camera as the Photoscan model origin
« Reply #3 on: January 09, 2018, 06:01:56 PM »
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.
Best regards,
Alexey Pasumansky,
Agisoft LLC

j.seinturier

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Make a camera as the Photoscan model origin
« Reply #4 on: January 13, 2018, 07:17:49 PM »
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

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15173
    • View Profile
Re: Make a camera as the Photoscan model origin
« Reply #5 on: January 13, 2018, 07:24:24 PM »
Hello Julien,

Yaw, pitch, roll are estimated in ENU (easting-north-up) coordinate space, so when you are making a transformation in script from internal camera system to this ENU space you should also apply PhotoScan.Matrix([1, -1, -1]) to bring the axis to the classical convention.
Best regards,
Alexey Pasumansky,
Agisoft LLC