Forum

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

Paulo

  • Hero Member
  • *****
  • Posts: 1333
    • View Profile
Thanks mks_gis,

actually in your Github, I see that most parameter changes I made (downscale for matchPhotos and buildDepthMaps, filter_mode for buildDepthMaps) are already introduced in your v7.4.

However, i do not really understand why generic_preselection is always set to False. Should it not be selectable or changeable  by user?

Best Regards,
Paul Pelletier,
Surveyor

mks_gis

  • Newbie
  • *
  • Posts: 41
    • View Profile
TBH, I can't remember why it is False. This script develops as and when I need it, SfM is only a small part of what I do. I'll look into it when I next edit it, but you seem to have the skill to develop it further for your needs.

BenW22

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Hi Everyone

Thanks to mks_gis for creating the "PScan Chunk Scripts v8 Metashape" script. It looks very comprehensive. Unfortunately for me, I have no scripting knowledge, but when I follow the instructions, I get the follownig error - 2023-03-18 11:17:58 Error: 'Metashape.Chunk' object has no attribute 'analyzePhotos'

Could anyone suggest how I could fix this? I am using metashape verision 2.0.0

I am testing the script on a small sample of 200 photos. I have successfully used the same photos in another job (without using the script) so I know what results should be.



Log extract -

2023-03-18 11:17:23 Log file to check progress: F:/testing of scripts\test for v8 py script_log_2023-03-18 11-17.txt
2023-03-18 11:17:30 The current path is: F:/testing of scripts
2023-03-18 11:17:30 The current file name prefix is: v8
2023-03-18 11:17:30 The current minimum acceptable image quality is: 0.7
2023-03-18 11:17:30 The current filtering method is: Metashape.FilterMode.MildFiltering
2023-03-18 11:17:30 The current projection accuracy is: 2
2023-03-18 11:17:30 The current reconstruction accuracy is: 10
2023-03-18 11:17:30 The current generic preselection is: True
2023-03-18 11:17:30 The current reference preselection is: True
2023-03-18 11:17:30 The current export CRS (EPSG Number) is [0 = project CRS]: 0
2023-03-18 11:17:58 Error: 'Metashape.Chunk' object has no attribute 'analyzePhotos'

Any help appreciated
>>>

mks_gis

  • Newbie
  • *
  • Posts: 41
    • View Profile
Hi

The script was last updated for version 1.8. There must have been changes to the Python API in the update to v2 which break the script, hence the error.
I will look at this and update the script when I have time, hopefully next week
I'll also need to check why the major version check didn't flag this as an issue.

Cheers

Paulo

  • Hero Member
  • *****
  • Posts: 1333
    • View Profile
Yes  for version 2 and higher use chunk.analyzeImages  instead of chunk.analyzePhotos
Best Regards,
Paul Pelletier,
Surveyor

BenW22

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Thanks to you both  - mks_gis and Paulo. I will substituate chunk.analyzeImages and see if I can get it to work.

Paulo

  • Hero Member
  • *****
  • Posts: 1333
    • View Profile
Hi BenW,

you will need to replace all instances of PointCloud with TiePoints
and point_cloud with tie_points
Best Regards,
Paul Pelletier,
Surveyor

BenW22

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Thank you Paulo,
Maybe that is why I'm getting these errors below. I will change as you suggest and try again.

2023-03-19 13:04:27 Error: 'NoneType' object has no attribute 'points'
2023-03-19 13:41:08 Error: type object 'Metashape.PointCloud' has no attribute 'Filter'

Paulo

  • Hero Member
  • *****
  • Posts: 1333
    • View Profile
Exactly and also change buildDenseCloud to buildPointCloud
« Last Edit: March 19, 2023, 06:35:21 PM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor

mks_gis

  • Newbie
  • *
  • Posts: 41
    • View Profile
I've updated the code for 2.0, script v8.0 on github:
https://github.com/gisportsmouth/PhotoScan-Automation-Script