I am new to python Agisoft. I try to export the point similar process to the GUI. However, it raised the error : Value Error: Invalid argument value: format. The code is shown in the below. Also, How can I choose between the dense point cloud and spare point cloud in the coding ? Moreover, I notice that the computation time is very different. When I use the GUI the processing time is very fast. But when I use the python API, it takes longer time. Do anyone know how to fix it. Thank you very much.
import Metashape
import textwrap
import glob
import os
global doc
doc = Metashape.app.document
print("Script started")
#creating new chunk
doc.addChunk()
chunk = doc.chunk
chunk.label = "New Chunk"
photo_list = list()
image_dir='Picture'
path_img = os.path.join(os.getcwd(),image_dir)
for j,img_file in enumerate(glob.glob(path_img+'/*.jpg')):
img_name = os.path.splitext(os.path.basename(img_file))[0]
photo_list.append(img_file)
keypoints = 40000 #align photos key point limit
tiepoints = 10000 #align photos tie point limit
chunk.addPhotos(photo_list)
#align photos
chunk.matchPhotos(downscale=1, generic_preselection=True, filter_mask = False, keypoint_limit = keypoints, tiepoint_limit = tiepoints)
chunk.alignCameras()
chunk.optimizeCameras()
chunk.buildDepthMaps(downscale=4, filter_mode=Metashape.AggressiveFiltering)
chunk.buildDenseCloud()
#building mesh
chunk.buildModel(surface_type=Metashape.Arbitrary, interpolation=Metashape.EnabledInterpolation)
#build texture
chunk.buildUV(mapping_mode=Metashape.GenericMapping)
chunk.buildTexture(blending_mode=Metashape.MosaicBlending, texture_size=4096)
Metashape.app.update()
#export
output_dir='Picture'
path_out = os.path.join(os.getcwd(),output_dir)
chunk.exportPoints(path = path_out + "/model.ply", format = "ply", colors = True)