Agisoft Metashape

Agisoft Metashape => Python and Java API => Topic started by: jzoken on October 29, 2015, 07:31:59 AM

Title: Adding Targets (both Automatic and user defined) via Python Script
Post by: jzoken on October 29, 2015, 07:31:59 AM
Hello Alexey,

I've recently upgraded to Agisoft 1.1.6 and, because of API changes, my code no longer runs. Unfortunately,  I can't figure out how to add  targets from the new documentation

Are you able to put together a couple of code fragments that show how this works?

Thanks,
Jack
Title: Re: Adding Targets (both Automatic and user defined) via Python Script
Post by: Alexey Pasumansky on October 30, 2015, 03:19:02 PM
Hello Jack,

You can use the following line as a reference for the automatic coded target detection:
Code: [Select]
chunk.detectMarkers( type = PhotoScan.TargetType.CircularTarget12bit, tolerance = 15)
For the marker projection definition you can use the following:
Code: [Select]
camera = chunk.cameras[0] #first camera in the chunk
marker = chunk.marker[0] #first marker in the chunk
marker.projections[camera] = (100, 200) #assigning (100, 200) coordinate to marker projection on the image related to the camera

to add new marker to the chunk use chunk.addMarker() function.