Forum

Author Topic: Python script modify camera Yaw Pitch angles  (Read 227 times)

Phogi

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Python script modify camera Yaw Pitch angles
« on: November 26, 2018, 10:19:16 AM »
Dear Support,

I had some searches in the forum but haven't found similar answers, so I post this new topic here.

What I want to achieve is, when I loaded the photos with orientation angles, is it possible to use python script to modify the angles rather than load a modified geotag file separately from GUI? For example an image Y/P/R is 17.2 / 0.5/0, and I want to change it from python to 180/89.5/0, is it possible to do from python api?

Thanks a lot!

Paulo

  • Full Member
  • ***
  • Posts: 212
    • View Profile
Re: Python script modify camera Yaw Pitch angles
« Reply #1 on: November 26, 2018, 10:55:23 AM »
Hello Phogi,

supposing cam is the first camera in your chunk, then to assign ( Y, P, R) as reference orientation angles (yaw, pitch, roll) you can use

cam.reference.rotation = PhotoScan.Vector( [Y, P, R] )


as in following console extract:

In [1]: chunk = PhotoScan.app.document.chunk

In [2]: cam = chunk.cameras[0]

In [3]: cam.reference.rotation
Out[3]: 2018-11-26 01:42:56 Vector([312.9, 0.0, -0.0])

In [4]: cam.reference.rotation = PhotoScan.Vector( [320, 2.0, -0.0] )

In [5]: cam.reference.rotation
Out[5]: 2018-11-26 01:42:56 Vector([320, 2.0, -0.0])

« Last Edit: November 26, 2018, 10:57:15 AM by Paulo »
Best Regards,

Paul Pelletier