Agisoft Metashape
Agisoft Metashape => Python and Java API => Topic started by: michaelzhangxc on August 24, 2014, 01:30:11 AM
-
Dear Sir,
I want to export a pdf file with a fixed model position.
I found the model position in the exported pdf file does not change with different shift vector values, for exemple [0,0,0] and [1000,1000,1000].
What's the reason?
Thank you for your advise.
[new_chunk = PhotoScan.app.document.activeChunk
filename="C:/3D/zx2.pdf"
Format="pdf"
new_chunk.exportModel(filename, binary=True, precision=6, texture_format="jpg", texture=True, normals=True,colors=True, cameras=True, format=Format, shift=[0,0,0])]
-
Hello michaelzhangxc,
Shift parameter subtracts the values from model coordinates, but doesn't effect on the view point. PDF is exported according to the current view in the Model frame. Viewpoint camera position and orientation can be changed via PhotoScan.app.viewpoint.
-
Thank you for your prompy reply, Alexey.
Then how can I input a parameter to change the viewpoint? The code below seems can not change the viwepoint.
[import PhotoScan
new_chunk = PhotoScan.app.document.activeChunk
filename="C:/zx1.pdf"
Format="pdf"
PhotoScan.Application.viewpoint
new_chunk.exportModel(filename, binary=True, precision=6, texture_format="jpg", texture=True, normals=True,colors=True, cameras=True, format=Format)
]
-
Hello michaelzhangxc,
viewpoint (= PhotoScan.app.viewpoint) has four parameters:
coo - center of the camera position,
fov - field of view (in degrees),
mag - magnitude,
rot - 3x3 rotational matrix.
So you need to input new values to one or more of them.
-
Thank you Alexey.
I tried to input a parameter, however it says the object is not callable as below:
Traceback (most recent call last):
File "C:/Python33/test.py", line 6, in <module>
PhotoScan.Application.viewpoint(coo=[0,0,0])
TypeError: 'getset_descriptor' object is not callable
Maybe I input in a wrong format?
[import PhotoScan
new_chunk = PhotoScan.app.document.activeChunk
filename="C:/3D PHOTO MANAGER/zx2.pdf"
Format="pdf"
PhotoScan.Application.viewpoint(coo=[0,0,0])
new_chunk.exportModel(filename, binary=True, precision=6, texture_format="jpg", texture=True, normals=True,colors=True, cameras=True, format=Format)]
-
Hello michaelzhangxc,
New values for viewpoint parameters should be assigned like shown below:
viewpoint = PhotoScan.app.viewpoint
viewpoint.coo = ...
viewpoint.rot = ...
viewpoint.mag = ...
viewpoint.fov = ...
-
It works well, thank you Alexey!
-
How would this work in 1.1.0 preview?