Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: Bolli on June 21, 2022, 08:11:32 PM

Title: detectMarkers 'CircularTarget12bit' is not defined
Post by: Bolli on June 21, 2022, 08:11:32 PM
Hi all,
I'm trying to work in a detectMarkers into a batch process via python. I'm using Metashape 1.8.3 and the 1.8.3 python api guide. I've basically copied this line of code from the api guide and the target type CircularTarget12bit is coming up as undefined ("NameError: name 'CircularTarget12bit' is not defined"). Is there another target type to represent the 12 bit Circular targets that I'm missing?

Code: [Select]
import Metashape
import os, sys
import time, datetime
import math
import json

#Define which document
doc = Metashape.app.document
doc.open(export_path + '/' + proj_name + '.psx')


#Define which chunk
chunk = Metashape.app.document.chunk

#Detect markers
chunk.detectMarkers(target_type = CircularTarget12bit,
                    tolerance = 50,
                    filter_mask = False,
                    inverted = False,
                    noparity=False)

doc.save()

Thanks for any and all advice!
Bolli
Title: Re: detectMarkers 'CircularTarget12bit' is not defined
Post by: Alexey Pasumansky on June 21, 2022, 08:45:23 PM
Hello Bolli,

Try to replace CircularTarget12bit with Metashape.CircularTarget12bit
Title: Re: detectMarkers 'CircularTarget12bit' is not defined
Post by: Bolli on June 21, 2022, 08:50:57 PM
That replacement worked. Thanks Alexey
Title: Re: detectMarkers 'CircularTarget12bit' is not defined
Post by: Paulo on June 21, 2022, 09:11:00 PM
Very good,

whenever a parameter refers to a Metashape Class than in API the parameter should be prepended by Metashape.