Hi,
I have a full body scanner (110 cameras) and am trying to automate to create a proper bounding box and then later to match the coordinate system to the bounding box. That last part works with the script publish on the wiki. (Thanks!)
My cameras are in an oval around the person. I want to use the location of 4 "corner" cameras in the buttom row to automatic set the bounding box.
I am able to center the bounding box based on these 4 cameras, but have a really hard time understaning the rotation numbers, this complex matrix.
Can someone please give me a better understanding how the rotation numbers work? Can I use certain points (camera locations) to calculate the correct rotation of the bounding box?
This is what I have so far: (to center the bounding box based on the 4 corner cameras)
import PhotoScan
import math
doc = PhotoScan.app.document
chunk = doc.chunks[0]
newregion = chunk.region
print ("Current region size: ", newregion.size)
print ("Current region center:", newregion.center)
print ("Current region rotation:", newregion.rot)
for camera in chunk.cameras:
if camera.label == '211.jpg':
c1 = camera
if camera.label == '101.jpg':
c2 = camera
if camera.label == '151.jpg':
c3 = camera
if camera.label == '166.jpg':
c4 = camera
print ("Camera centers:")
print (c1.center)
print (c2.center)
print (c3.center)
print (c4.center)
print (" ")
x = (c1.center[0] + c2.center[0] + c3.center[0] + c4.center[0] ) /4
y = (c1.center[1] + c2.center[1] + c3.center[1] + c4.center[1] ) /4
z = (c1.center[2] + c2.center[2] + c3.center[2] + c4.center[2] ) /4
print ("X average: ", x)
print ("Y average: ", y)
print ("Z average: ", z)
print (" ")
m = PhotoScan.Matrix([c1.center, c3.center, c5.center])
updateregion = PhotoScan.Region()
updateregion.center = PhotoScan.Vector([x,y,z])
updateregion.rot = m
updateregion.size = newregion.size
chunk.region = updateregion