Forum

Author Topic: Pass a string variable to PhotoScan as a parameter !!!RESOLVED!!!  (Read 2853 times)

IanManning

  • Newbie
  • *
  • Posts: 16
    • View Profile
Hi Folks,

Working on some scripting and have run into a road-block. I've got a script set-up to re-cursively test accuracy settings for the initial alignment.

I've got a list containing the Accuracy Settings (PhotoScan.HighAccuracy, PhotoScan.MediumAccuracy)

When I try to pass one of these values to the matchPhotos parameter I get the error

2016-02-24 14:30:08 TypeError: argument 1 must be PhotoScan.Accuracy, not str

I understand the error, the program doesn't want a string (which is what I'm serving it from the list) via my iterator. Is there a way to get around this, by somehow converting my string into something PhotoScan will accept?

I've made a separate version of the script where the accuracy settings are hard coded that works fine as a back-up. I just want to clean this up, so I can make quicker changes as required.

Thank you,
Ian

« Last Edit: February 25, 2016, 05:03:23 PM by IanManning »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14755
    • View Profile
Re: Pass a string variable to PhotoScan as a parameter
« Reply #1 on: February 25, 2016, 12:13:41 AM »
Hello Ian,

Can you post the line where you define the list with the parameters?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Gall

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Re: Pass a string variable to PhotoScan as a parameter
« Reply #2 on: February 25, 2016, 12:01:59 PM »
You can convert a string parameter to an actual PhotoScan.Accuracy parameter this way:
Code: [Select]
PhotoScan.Accuracy.values[accuracy]where accuracy can be one the following values.
Code: [Select]
['HighestAccuracy', 'HighAccuracy', 'MediumAccuracy', 'LowAccuracy', 'LowestAccuracy']
This actually works for all enum classes.

IanManning

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Pass a string variable to PhotoScan as a parameter
« Reply #3 on: February 25, 2016, 05:02:46 PM »
Thank you Alexey and Gall for responding.

@Gall, that worked perfectly, thank you for the suggestion! I knew there had to be a way to get at that functionality.

.value worked like a charm. Script looks much better, and allows for easily changing structure.

Thanks again,
Ian