I am working with a turntable capture. I have a stack of four cameras, each tilted down different amounts. I have aligned my chunk so that the rings of cameras are parallel to the x-z plane and y is up through the center of the rings (see attached picture). I want to know how far each camera is tilted away from parallel to the y-axis.

Here is my failed attempt -- the script runs, but the results don't make sense:

`import math`

import PhotoScan

def getTilt(chunknum=0):

chunk = PhotoScan.app.document.chunks[chunknum]

for camera in chunk.cameras:

if camera.transform is not None:

rot = camera.transform.rotation()

#y-axis unit vector

v0 = [0.0,1.0,0.0]

#y-axis rotated by the camera rotation matrix

v1 = rot*PhotoScan.Vector(v0)

#normalize y-vector just in case

v1length = (v1[0]**2+v1[1]**2+v1[2]**2)**(1/2.)

v1 = [v/v1length for v in v1]

#determine angle between y-axis and rotated y-axis with dot product

theta = math.acos(v1[0]*v0[0]+v1[1]*v0[1]+v1[2]*v0[2])

print('angle: {} im: {}'.format(theta*180/math.pi,camera.label[0:]))

if __name__ == "__main__":

getTilt(0)