Forum

Author Topic: Marker.Projection coords  (Read 1985 times)

Miles_WADNR

  • Newbie
  • *
  • Posts: 5
    • View Profile
Marker.Projection coords
« on: December 20, 2018, 11:18:26 PM »
Hi there,
I'm trying to understand how to interact with markers through the python API. My first question is about the Marker.Projection class, and the "coord" variable.
Does it define pixel XY coordinates for a marker in a specific image? And if so, how do I choose what frame I'm viewing coordinates for?
Eventually, I'd like to assign marker positions using XY coordinates in a few images (e.g., Marker_1.add_reference(DJI_0001.jpg, X=1999, Y=2004) or something like that). Feel free to point me to an existing thread if one already exists.

Thanks very much.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Marker.Projection coords
« Reply #1 on: December 21, 2018, 03:16:05 PM »
Hello Miles_WADNR,


At first you need to find the camera where the marker projection should be put, then use the projection assignment using XY coordinates and pinned/unpinned status:

Code: [Select]
import PhotoScan
chunk = PhotoScan.app.document.chunk
label = "DJI_0001.jpg"
for camera in chunk.cameras:
    if camera.label == label:
        X = 1999
        Y = 2004
        marker.projections[camera] = PhotoScan.Marker.Projection(PhotoScan.Vector([X, Y]), True)
        break

Best regards,
Alexey Pasumansky,
Agisoft LLC