Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: Malalako on November 23, 2017, 01:12:58 PM

Title: Need basic newbie instructions for using Split in Chunks script
Post by: Malalako on November 23, 2017, 01:12:58 PM
Hi

So I've used Agisoft a few times in the past but this project I'm currently working on is much larger and I think I'm going to have to split it into chunks to get it processed. I understand that there is a "Split in Chunks" python script that I can use to do this. But having never used a script before, let alone python, I really need some basic newbie instructions. So I went to the wiki and downloaded the Split_in_chunks.py file. Do I need to save this in a specific location associated with my Agisoft files or just somewhere that I can find it. I then go to Agisoft and go to Tools>Run Script and in the the Run Python Script box that pops up I browse to where I saved the script. Now if I just press ok it comes up with the error "Can't Run Script". I'm guessing that's because I need to specific arguments about how I want it to run (e.g. quality and depth filtering etc). But how do I do this? Do I change the actual script document or do I input them into the "arguments" section of the "Run Python Script" box? In either case, how exactly do I type it out. I'm using Agisoft version 1.3.2. build 4205.

For example I see the script starts off with:
QUALITY = {"1":PhotoScan.UltraQuality,
         "2":PhotoScan.HighQuality,
         "4":PhotoScan.MediumQuality,
         "8":PhotoScan.LowQuality,
         "16":PhotoScan.LowestQuality}

Do I delete all the ones I don't want. Or do I just change it down in this section:

if buildDense:
               if new_chunk.depth_maps:
                  reuse_depth = True
                  quality = QUALITY[new_chunk.depth_maps.meta['depth/depth_downscale']]
                  filtering = FILTERING[new_chunk.depth_maps.meta['depth/depth_filter_mode']]
                  try:
                     new_chunk.buildDenseCloud(quality = quality, filter = filtering, keep_depth = False, reuse_depth = reuse_depth)
                  except RuntimeError:
                     print("Can't build dense cloud for " + chunk.label)
                     
               else:
                  reuse_depth = False
                  try:
                     new_chunk.buildDenseCloud(quality = PhotoScan.Quality.HighQuality, filter = PhotoScan.FilterMode.AggressiveFiltering, keep_depth = False, reuse_depth = reuse_depth)
                  except RuntimeError:
                     print("Can't build dense cloud for " + chunk.label)




Apologies for such basic questions. If anyone could provide very detailed instructions about how to go about this, then it'd really help me out.

Title: Re: Need basic newbie instructions for using Split in Chunks script
Post by: Alexey Pasumansky on November 23, 2017, 01:39:02 PM
Hello Malalako,

Please use the following script version for PhotoScan Pro 1.3.4:
https://github.com/agisoft-llc/photoscan-scripts/blob/master/src/split_in_chunks_dialog.py

You do not need to edit the script body and use any arguments in the Run Script dialog.

If the script cannot be started ("Can't run script") please provide the Console pane output related to the error.
Title: Re: Need basic newbie instructions for using Split in Chunks script
Post by: Malalako on November 23, 2017, 08:59:56 PM
Thanks Alexey. I tried that script and the same error came up. I've attached a copy of the console output. Sorry if I'm just making a really basic mistake.
Title: Re: Need basic newbie instructions for using Split in Chunks script
Post by: Alexey Pasumansky on November 23, 2017, 11:12:04 PM
Hello Malalako,

Please save the following page content as .py file:
https://raw.githubusercontent.com/agisoft-llc/photoscan-scripts/master/src/split_in_chunks_dialog.py

It seems that you have saved the complete HTML page instead of the script.