Forum

Author Topic: shift vector function in exportModel  (Read 5671 times)

michaelzhangxc

  • Newbie
  • *
  • Posts: 13
    • View Profile
shift vector function in exportModel
« 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.

Code: [Select]
[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])]

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14107
    • View Profile
Re: shift vector function in exportModel
« Reply #1 on: August 24, 2014, 08:04:07 AM »
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.
Best regards,
Alexey Pasumansky,
Agisoft LLC

michaelzhangxc

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: shift vector function in exportModel
« Reply #2 on: August 24, 2014, 06:50:14 PM »
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.

Code: [Select]
[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)

]

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14107
    • View Profile
Re: shift vector function in exportModel
« Reply #3 on: August 25, 2014, 04:48:47 PM »
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.
Best regards,
Alexey Pasumansky,
Agisoft LLC

michaelzhangxc

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: shift vector function in exportModel
« Reply #4 on: August 25, 2014, 06:32:31 PM »
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?
Code: [Select]
[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)]

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14107
    • View Profile
Re: shift vector function in exportModel
« Reply #5 on: August 26, 2014, 01:17:03 PM »
Hello michaelzhangxc,

New values for viewpoint parameters should be assigned like shown below:

Code: [Select]
viewpoint = PhotoScan.app.viewpoint
viewpoint.coo = ...
viewpoint.rot = ...
viewpoint.mag = ...
viewpoint.fov = ...
Best regards,
Alexey Pasumansky,
Agisoft LLC

michaelzhangxc

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: shift vector function in exportModel
« Reply #6 on: August 26, 2014, 06:30:06 PM »
It works well, thank you Alexey!

r0xx

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: shift vector function in exportModel
« Reply #7 on: December 24, 2014, 01:26:07 PM »
How would this work in 1.1.0 preview?