Forum

Author Topic: Automated PS script to process single or multiple chunks - opinions please  (Read 601 times)

mks_gis

  • Newbie
  • *
  • Posts: 25
    • View Profile
***Please see later posts for updated script

Hi,

 I started a script a while ago to automate some steps, which turned into a full blown automated script, including gradual selection. I use it for UAV and close range work.

 I'd like some opinions from you good people as to the underlying processing logic. I often have to run multiple models with different settings, so I create one PS doc and have multiple chunks, although it does work with just one chunk. I set up the images, coord sys for each chunk, add GCP where applicable and then, so I don't need to supervise, I just run the script, leave it for the weekend and have all data ready come Monday. Seems to work...

The script creates menu options to cater to my specific needs, but can be adapted.

Some points I could use some clarification on:
I use adaptive, although it is now set to False by default (http://www.agisoft.com/forum/index.php?topic=9401.0). I'm not sure why that was changed and when it should be used.
 
I use optimizeCameras without parameters, trusting PS to select the right ones. Should I set parameters?

My automated gradual selection process is:
Reconstruction uncertainty to 10 - optimize
Projection Accuracy to 10 (models) or 3 (UAV) - optimize
Reprojection error - self-adjusting to find the right value to leave me with 10% of the original points - optimize

Suggestions very welcome
Cheers
M
« Last Edit: August 31, 2018, 07:47:19 PM by mks_gis »

mks_gis

  • Newbie
  • *
  • Posts: 25
    • View Profile
tweaked automatic gradual selection process
« Reply #1 on: August 29, 2018, 01:16:34 PM »
***Please see later posts for updated script

I've tweaked the optional grad sel process:
1. rec uncert of 10, unless > 50% are selected, then self adjusting - optimise
2. proj acc self adjusting to select < 50% of ties left after 1 - optimise
optional break - allow for adding GCP
3. repro error self adjusting in 10% steps/optimise to select up to 80% of the initial ties.

Loosely based on USGS workflow discussed here: http://www.agisoft.com/forum/index.php?topic=9485.msg44134#msg44134

Seems to work with P4 images, Sony a6000 UVA images and DSLR close range models to reduce pixel errors. I know it's not a substitute for trying to tweak individual models for max accuracy, but good for quickly processing to a good standard, I believe. Happy to take comments.

Also added logging of values used in each step for reference if needed later.
« Last Edit: August 31, 2018, 07:47:27 PM by mks_gis »

mks_gis

  • Newbie
  • *
  • Posts: 25
    • View Profile
Spotted a mistake, gradual selection currently only works for single chunks...

mks_gis

  • Newbie
  • *
  • Posts: 25
    • View Profile
fixed

needs to run as one session though, i.e if you've run the script keep the session open for grad sel process

Hydro_Ydé

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Automated PS script to process single or multiple chunks - opinions please
« Reply #4 on: September 01, 2018, 01:35:33 PM »
Thank you Mks_gis for sharing this ! Have to try this.

Quick stop after "log file to check progress :" followed by a mixed / & \ file name.
« Last Edit: September 01, 2018, 04:18:44 PM by Hydro_Ydé »

ahyakbaba

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Automated PS script to process single or multiple chunks - opinions please
« Reply #5 on: November 03, 2018, 09:25:18 PM »
thanks for your really useful posts. also may i have your workflows as you put your custom menu for each command

mks_gis

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Automated PS script to process single or multiple chunks - opinions please
« Reply #6 on: November 06, 2018, 12:30:38 PM »
Currently needs to be run as one session, valid ties not accessible after
    gradual selection. To be fixed in next version using tracks.
   
    len(chunk.point_cloud.points) - valid ties
    len(chunk.point_cloud.tracks) - all ties

With gradual selection:
    After alignment the model is optimised and then a gradual selection is run.
    After the align process all tie points have errors attached
            to them. The values used are a matter of debate.
            Rec Uncert is normally set to 10 and run only once. If
            the value of 10 selects more than 50% of the tie points the value
            self-adjusts to less than 50%.
            Proj acc is set to start at 2 and self adjusts so less
            than 50% of the tie points left after Rec Uncert are selected.
            For Reprojection Error the aim is to select up to a set percentage
            (default 80) of the initial tie points. The value used is self
            selecting. The selection process is in steps of 10% and optimisation
            is run after each step.
            Values used are saved in the log file.
           
Without gradual selection:
    After alignment the model is optimised once.

3D Model/Geo: Geo basically is anything where the photos have coordinates or you are using Ground Control Points(GCP). If you have photos of objects without that info use 3D Model

Set-up workflow:
1. Set up your chunk(s)
    import photos
    name chunks (optional - helps in sorting the output)
    save a copy of the PS Doc

Custom workflow:
2. (Geo) Set reference system for each chunk
3. Load script
    chose output folder
    chose file prefix (this gets added to each output file - helps if trying different settings)
4. Under "Change Values" select "Get Current Parameter info" (check console window for output)
    check image quality threshold
    check filtering (options: Mild (default), Moderate, Aggressive, none)
    (Geo) check export CRS (in case you want the output to be different from the CRS of the camera/GCP)

No GCP or checking alignment - runs whole process and exports:
5a. (Geo) Choose "Custom":"Run - Geo" (with or without gradual selection)
or
5b. (3D Model) Choose "Custom":"Run - 3D Model" (with or without gradual selection)

With GCP or scales or if wanting to check alignment:
5. Choose "Custom":"Align only" (with or without gradual selection)
6. Set up GCP for each chunk or set scale
7. Check alignment
8a. (Geo) Choose "Custom":"Run all after alignment - Geo" (with or without gradual selection)
or
8b. (3D Model) Choose "Custom":"Run all after alignment - 3D Model" (with or without gradual selection)

Files generated depend on method used (3D or Geo) and input photos.

You can run methods individually as well after opening the script, in console type "ps_doc." and then hit "TAB" to see the options.