Hey @ all,
currently I'm stuck with a custom python script for rotating the projection plane for the orthomosaic generation along the z-axis. Due to being able to document the rotation along the z-axis for further projects at the same site, I want to use a custom input for the degree of the rotation.
So far, I've managed to create the input dialog, a custom menu item and to pass the sin and cos of the typed in degree value to the rotation matrix; that's all working fine.
The only thing I'm stuck with is the generated orthomosaic. Unlike my intention the image itself is rotated, not the projection plane. I think I've messed up the rotation matrix. Here is my script:
import PhotoScan
from math import sin, cos, radians
doc = PhotoScan.app.document
def TEST_orthowinkel():
doc = PhotoScan.app.document
chunk = doc.chunk
PhotoScan.app.messageBox("Script opened, be happy about it!")
TEST_Winkel = PhotoScan.app.getFloat(label="Please insert rotation degree!")
TEST_sin = sin(radians(TEST_Winkel))
TEST_cos = cos(radians(TEST_Winkel))
TEST_sin = ("{0:.2f}".format(TEST_sin))
TEST_cos = ("{0:.2f}".format(TEST_cos))
TEST_Winkel = str(TEST_Winkel)
TEST_sin = str(TEST_sin)
TEST_cos = str(TEST_cos)
PhotoScan.app.messageBox(TEST_Winkel)
PhotoScan.app.messageBox(TEST_sin)
PhotoScan.app.messageBox(TEST_cos)
TEST_sin = float(TEST_sin)
TEST_cos = float(TEST_cos)
TEST_ortho = PhotoScan.Matrix( [[TEST_cos,-TEST_sin,0,0],[TEST_sin,TEST_cos,0,0],[0,0,1,0],[0, 0, 0, 1]] )
proj = TEST_ortho
for chunk in doc.chunks:
chunk.buildOrthomosaic(surface=PhotoScan.DataSource.ModelData,blending=PhotoScan.BlendingMode.MosaicBlending,color_correction=False,projection=proj)
PhotoScan.app.addMenuItem("Profile Export/Generate orthomosaic for trench profiles", TEST_orthowinkel)
So my questions are:
1.) Do I need to align the bounding box along the used coordinate system at first?
2.) How has the projection matrix to be defined in order to rotate the projection plane along the z-axis?
Thank you in advance for your answers!
All the best,