Forum

Author Topic: Creating different chunks from bounding boxes using a python script  (Read 2510 times)

manoloribera

  • Newbie
  • *
  • Posts: 7
    • View Profile
Hello,

I have a script python where different steps are realised:
- align photos
- optimisation of the alignment
- detection of the targets
- import of a csv file + assignment of the distance between different targets
- update of the transformation (chunk.updateTransform() )
- build a dense cloud
- exportation of the report


My request is:
- First of all I would like to be asked how many objects appear on the project (I know the number and I want to be asked to enter the value)
- I would like my script to automatically "pause" after the "update of the transformation" step, and then it should want me to manually define as many bounding boxes as the number of objects given before, using the "resize region" tool.
( it would be great if for each bounding box it should ask me to rename it )
( when the number of bounding boxes created = the number given before, then the script should automatically continue the last 2 steps (build dense cloud + exportation of the report )
- Then, for each bounding box created a new chunk should be created

The idea is to then process the dense cloud but on each chunk and not on the whole project! (this will save a lot of calculation time) 

If anyone has an idea how to realise this, I would be very happy to know it!


Thank you very much for your help

if anything is not clear enough, please let me know and I'll try to be clearer !


Manolo

manoloribera

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Creating different chunks from bounding boxes using a python script
« Reply #1 on: March 07, 2017, 10:51:05 AM »
For the first point, I have heard that I can simply write the number in the "argument" field just under the field where I look for the directory where my Python script is.

Is this correct ?


Thanks,

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: Creating different chunks from bounding boxes using a python script
« Reply #2 on: March 07, 2017, 11:10:20 AM »
Hello manoloribera,

I think, you can use the following script as a reference, how the chunks can be duplicated and the original bounding box split into minor parts:
http://wiki.agisoft.com/wiki/Split_in_chunks.py

You can pass your own arguments (values) to the script using Arguments field in Run Script dialog. to access them, use sys.argv list. The first element would be the path the script.
Best regards,
Alexey Pasumansky,
Agisoft LLC

manoloribera

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Creating different chunks from bounding boxes using a python script
« Reply #3 on: March 07, 2017, 03:36:41 PM »
Thank you for your answer, i'll try to understand this code and use it :)