Forum

Author Topic: Problems with saving and export  (Read 6847 times)

patrick_f

  • Newbie
  • *
  • Posts: 5
    • View Profile
Problems with saving and export
« on: August 13, 2017, 10:28:16 PM »
Hi,

I use a standard phyton script but I have some problems:
I hope someone can help me. Here is the script:
Code: [Select]
import PhotoScan

doc = PhotoScan.app.document
doc.open("project.psz")
chunk = doc.chunk
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=True, reference_preselection=False)
chunk.alignCameras()
chunk.buildDenseCloud(quality=PhotoScan.MediumQuality)
#chunk.buildDenseCloud(quality=PhotoScan.MediumQuality, filter=PhotoScan.NoFiltering, reuse_depth=True)
chunk.buildDenseCloud(quality=PhotoScan.MediumQuality, filter=PhotoScan.NoFiltering, keep_depth=True)
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation)
chunk.buildUV(mapping=PhotoScan.GenericMapping)
chunk.buildTexture(blending=PhotoScan.MosaicBlending, size=4096)
doc.save()
modelname = path+"\\output\\model.obj"
chunk.exportModel(modelname, binary=True, precision=6, ImageFormat="JPG", texture=True, normals=True, colors=True, cameras=False, udim=False, strip_extensions=False, format="OBJ")
doc.save(path = "C:\3dscan\test\project.psz", chunks = [doc.chunk])


The problems are: Chunk export doesn´t work and doc.save
Software and Version: Agisoft Photoscan Pro 1.3.2

I´m looking forward to your support!
Best Patrick

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: Problems with saving and export
« Reply #1 on: August 14, 2017, 09:37:18 AM »
Hello Patrick,

Is the project opened and do other processing steps work properly?

When you are loading the project, you are using relative path, not absolute, also I don't see where the path variable is defined.

If possible, please also provide the Console pane output with the error message.
Best regards,
Alexey Pasumansky,
Agisoft LLC

patrick_f

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Problems with saving and export
« Reply #2 on: August 14, 2017, 11:39:06 AM »
Hi Alexey,

thank you for your reply!
I made some adaptions on the script but it still doesn´t work properly. Here is the current script with the error from the console

Code: [Select]
import PhotoScan

doc = PhotoScan.app.document
doc.open("project.psz")
chunk = doc.chunk
chunk.matchPhotos(accuracy=PhotoScan.HighAccuracy, generic_preselection=True, reference_preselection=False)
chunk.alignCameras()
chunk.buildDenseCloud(quality=PhotoScan.MediumQuality)
chunk.buildDenseCloud(quality=PhotoScan.MediumQuality, filter=PhotoScan.NoFiltering, keep_depth=True)
chunk.buildModel(surface=PhotoScan.Arbitrary, interpolation=PhotoScan.EnabledInterpolation, source=PhotoScan.DenseCloudData)
chunk.buildUV(mapping=PhotoScan.GenericMapping)
chunk.buildTexture(blending=PhotoScan.MosaicBlending, size=4096)
doc.save()
path = "D:\\test\\"
print (path)
doc.save(path + "test.psz")
chunk.exportModel(path, binary=True, precision=6, texture_format=PhotoScan.ImageFormatJPEG, texture=True, normals=True, colors=True, cameras=False, udim=False, strip_extensions=False, format=PhotoScan.ModelFormatOBJ)


Error:
Code: [Select]
2017-08-14 10:23:27   File "C:/Program Files/Agisoft/PhotoScan Pro/python/Lib/site-packages/TEST_Patrick.py", line 19, in <module>
2017-08-14 10:23:27     chunk.exportModel(path, binary=True, precision=6, texture_format=PhotoScan.ImageFormatJPEG, texture=True, normals=True, colors=True, cameras=False, udim=False, strip_extensions=False, format=PhotoScan.ModelFormatOBJ)
2017-08-14 10:23:27 RuntimeError: Can't export model: D:\test\-14 10:02:31 TypeError: 'ImageFormat' is an invalid keyword argument for this function
>>>

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: Problems with saving and export
« Reply #3 on: August 14, 2017, 11:52:36 AM »
Hello Patrick,

Can you modify the path in the exportModel function to path+"output\\model.obj"?
Best regards,
Alexey Pasumansky,
Agisoft LLC

patrick_f

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Problems with saving and export
« Reply #4 on: August 14, 2017, 12:14:52 PM »
Hi Alexey,

Great now it works....  Thanks for the quick support!
Now I will integrate this script in a more complex script... I hope it will work... 

Best Patrick