Forum

Author Topic: Python Script for Automation of Specific Workflow  (Read 2007 times)

abalaj4

  • Newbie
  • *
  • Posts: 1
    • View Profile
Python Script for Automation of Specific Workflow
« on: December 13, 2022, 08:55:58 AM »
Greetings to everyone!

I'm a student from Western University, Canada. I'm using Metashape to generate 3D models of hands using the photogrammetry scanner in my lab to design orthotics. The student before me has listed specific steps in his documentation that has to be followed. My supervisors have asked me to try to automate these steps using Python.

I'm a mechanical engineer and I've never studied Python. I know that is not an excuse and I know Python has tons of applications in the field of mechanical engineering. But I was never interested or focused on that aspect of this field. So, this will be my first time using it.

I really need help with this because I'm completely lost. If anyone can help me figure this out, it'll be a great help.

I'll list the steps followed by my peer in Metashape below:

1) From the Workflow tab at the top, select Add Photos and choose all the 42 photos in the path folder in which the photos required to make the model are present.

2) Right click on Chunk, navigate to Import, and choose Import Cameras.

3) From the browser that opens, navigate to the AGISOFT folder in the D: drive, select the “CameraCalibrationJuly6.xml” file and open it. 

4) Select “Build Point Cloud” from the Workflow tab and click OK.

5)From the model tab in the top bar click gradual selection.

6)In the window that pops up, choose reconstruction uncertainty from the criterion drop down menu and enter 10 into the level field, click OK, then press the delete key 

7) Go to the tools tab in the top bar, select optimize cameras, check the box labeled adaptive camera model fitting under the advanced options, and click OK

8) Repeat step 5 (gradual selection)

9) In the window that pops up, choose reprojection error from the criterion drop down menu and enter 0.5 into the level field, then click OK, then press the delete key

10) Repeat step 7 (optimize cameras)

11) Repeat step 5 (gradual selection)

11) In the window that pops up, choose projection accuracy from the criterion drop down menu and enter 10 into the level field. 

Note in the bottom left of the model pane the number of points in the model and number of points selected are shown. The goal for this step is to select roughly 10% of the points

 If entering 10 into the level field does not select 10% of the points, try 9, then 8, then 7, etc. until 10% are selected. Decimals are acceptable inputs, for example 8.5

12) Click OK, then press the delete key

13) Repeat step 7 (optimize cameras) \

14) Under the workflow tab on the top bar select build dense cloud. Quality should be high and Depth filtering should be Aggressive.

15) From workflow select build mesh.

I would like to thank everyone who replies to this in advance. I know its very amateurish to ask a question of this scale in this forum and I apologize. But it'll be really helpful if someone can help me do this. Thank you.

Paulo

  • Hero Member
  • *****
  • Posts: 1324
    • View Profile
Re: Python Script for Automation of Specific Workflow
« Reply #1 on: December 13, 2022, 11:55:43 AM »
Hi abalaj4,

I think you should do search in forum for general workflow scripts to get you started. Just in the  Agisoft github there is a general workflow script that could be a good starting point...

https://github.com/agisoft-llc/metashape-scripts/blob/master/src/samples/general_workflow.py.

I was a complete newbie in Python but looking, searching and doing a lot a trial and error has gotten me quite a bit further!

Cheers,
Best Regards,
Paul Pelletier,
Surveyor