Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Alexey Pasumansky

Pages: [1] 2 3 ... 856
Hello eastonmbio,

If you need to apply some custom operation, which cannot be defined via Tasks/NetworkTasks classes, you should use RunScript task and integrate it to the workflow.

I have just posted an example of such pipeline, when it is necessary to open the project and configure the raster transformation, prior to the export operation, please check the code example here:

In the RunScript task you should open the project, perform the required operations and save the project.

Python and Java API / Re: Console output and stdout
« on: June 12, 2021, 04:16:28 PM »
Hello marg,

I think that the easiest way would be redirecting the script output from the OS command-line directly (providing that the script is started in headless mode):
Code: [Select]
metashape.exe -r > output.txt 2>&1

Hello Adam,

I have prepared the script prototype for the processing workflow + export operations, assuming that the project with the added images and coordinate information already exists.
Code: [Select]
import Metashape, sys

root = "//NAS1/datasets" # can be passed as a script argument if required #root = sys.argv[1] = "//NAS1/datasets"
project_path = "/processing/temp/project.psx" #relative path to project #project_path = sys.argv[2] #can be defined as script argument
output_folder = root + "/processing/export/" #absolute path to output folder for exports
doc = Metashape.Document() + project_path) #loading existing project using relative path from the root
chunk = doc.chunk #active chunk of the project

tasks = []
#processing tasks
task = Metashape.Tasks.MatchPhotos()
task.downscale = 1
task.keypoint_limit = 40000
task.tiepoint_limit = 10000
task.generic_preselection = True
task.reference_preselection = True

task = Metashape.Tasks.AlignCameras()

task = Metashape.Tasks.OptimizeCameras()

task = Metashape.Tasks.BuildDepthMaps()
task.downscale = 4
task.filter_mode = Metashape.MildFiltering

task = Metashape.Tasks.BuildDenseCloud()

task = Metashape.Tasks.BuildDem()
task.source_data = Metashape.DenseCloudData

task = Metashape.Tasks.BuildOrthomosaic()
task.surface_data = Metashape.ElevationData

#export tasks
task = Metashape.Tasks.ExportRaster()
task.path = output_folder + '/dem.tif'
task.source_data = Metashape.ElevationData

task = Metashape.Tasks.ExportRaster()
task.path = output_folder + '/orthomosaic_default.tif'
task.source_data = Metashape.OrthomosaicData
task.raster_transform = Metashape.RasterTransformType.RasterTransformNone
task.save_alpha = False

task = Metashape.Tasks.RunScript() #switching raster transformation in the project
task.code = 'import Metashape\ndoc = Metashape.Document()\ + "' + project_path + '", ignore_lock = True)\nchunk = doc.chunk\nchunk.raster_transform.formula = ["(B4-B2)/(B4+B2)"]\nchunk.raster_transform.enabled = True\\n'

task = Metashape.Tasks.ExportRaster()
task.path = output_folder + '/orthomosaic_NDVI.tif'
task.source_data = Metashape.OrthomosaicData
task.raster_transform = Metashape.RasterTransformType.RasterTransformValue
task.save_alpha = False

#converting tasks to network tasks
network_tasks = []
for task in tasks:
if == Metashape.Tasks.DocumentTarget:

client = Metashape.NetworkClient()
client.connect(SERVER_IP) #
batch_id = client.createBatch(doc.path, network_tasks)

Upon working on the script we have figured out that it would be helpful, that toNetworkTask and createBatch calls could automatically consider root path, this has been implemented in the version 1.7.4 build 12511 (pre-release), therefore I suggest to use the pre-release version when checking the script:
If the script is used with 1.7.3 release version, the script requires modification in the parts related to the paths.

Hello ppant,

The specified message "Unsupported format: .tif" could be related to export points or export tiled model operations only, so I suggest to check, that in those operations correct file extension is used. As it seems, that the error appears in another block of code.

Hello danimlk,

For buildModel operation which uses depth maps data as a source, I suggest to add the following lines for the vertex colors calculation:

Code: [Select]
colorizeModel = Metashape.Tasks.ColorizeModel()
colorizeModel.source_data =Metashape.DataSource.ImagesData

Hello ppant,

The same code worked fine in 1.6.6 version as well.

Do you observe the same behavior on any project or if the issue is specific to the certain project only? Do you observe the same problem after re-starting Metashape instance and using only the lines that you have provided for any multispectral project?

Hello ppant,

I've just copied your code to the Console pane for the random multispectral project (had to perform chunk variable initialization, though), and it worked as expected without the reported error.

I have used 1.7.3 release version. Please check, if you observe the error on your side in the latest release version. I can also suggest to check, if the problem persists after Metashape re-start.

Python and Java API / Re: exportPoints() deletes cloud
« on: June 10, 2021, 08:46:23 PM »
Hello forumname,

Does it help, if you add the following line to the final loop before the export line:
Code: [Select]

Python and Java API / Re: exportPoints() deletes cloud
« on: June 10, 2021, 02:05:12 PM »
Hello forumname,

I am not observing such behavior on random project with the dense point cloud.

Please specify, which Metashape version you are using and whether you observe similar behavior if you try to export point using application GUI?

General / Re: project loading error
« on: June 09, 2021, 07:41:38 PM »
Hello Maxime,

Can you please provide the information from the Console pane related to the error (if there's any sensible part in the paths, you can manually remove it before posting)?

I would assume that the problem could be related to the corrupted information related to the shapes, but cannot say for sure, based on the provided screenshot only.

Additionally please specify, if there's any specific reason, why you are using very old PhotoScan Pro version.

Hello belinda,

I suggest to check the latest release version (or at least 1.6.6 version), as the issue seems to be related to the already fixed bug.

General / Re: build mesh from depth maps vs dense cloud
« on: June 07, 2021, 09:11:56 PM »
Hello JJ,

Which settings you are using for the both approaches (parameters in Build Dense Cloud and Build Mesh dialog)?

I think that the extrapolated parts could be filtered out and removed by the confidence filter for the depth maps based mesh generation approach.

Hello JJ,

For fisheye lens it is strongly suggested to switch the camera type for the related camera calibration groups in Tools Menu -> Camera Calibration dialog to Fisheye prior to the camera alignment procedure.

General / Re: How to update tiled model coordinates ?
« on: June 07, 2021, 02:59:26 PM »
Hello cyrilp,

Yes, it should work in that way.

Hello kirk,

If you shrink the bounding box to the area of interest, you would be able to run Build Mesh operation with "reuse depth maps" option enabled. Mesh will be generated only within the selected region.

Pages: [1] 2 3 ... 856