Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: 3dhugo on October 20, 2014, 06:37:03 PM

Title: filter markers by name
Post by: 3dhugo on October 20, 2014, 06:37:03 PM
Hi all,

I would appreciate your help. I am unsure how to access the marker object name in python.

I am using a known number of markers in a certain range on fixed rig. All markers are > 600, partially obstructed markers commonly show up with values in the 1-300 range, so i want to filter any values less than 600 as shown below:

markers = chunk.markers
numMarkers = len(markers)
print(str(numMarkers) + " markers detected") 

#limit markers to 48
if numMarkers > 48:
   #go through all markers
   for i in markers:
         
      #retrieve marker number, check if marker is within valid range (< 600)

      num = ??
      print(num)

      if num < 600:
         #remove accordingly


How can i access the int that is the marker name for use in the conditional? I wrongly began by using calling index, though this only gives me the position of a marker in the list, not any information on the marker name.

Thanks for any help you can give.


Title: Re: filter markers by name
Post by: Alexey Pasumansky on October 20, 2014, 06:45:01 PM
Hello 3dhugo,

Marker name is accessible through marker.label. It is a string, so if you are comparing with the number you need to convert it to integer using int(marker.label) or convert number to string using str(num).
Title: Re: filter markers by name
Post by: 3dhugo on October 20, 2014, 06:50:13 PM
Hi Alexey,

Great that really helps. Thanks for the quick response!