Forum

Author Topic: How to add marker using camera's coordinates.  (Read 6176 times)

koriel-angelswing

  • Newbie
  • *
  • Posts: 22
    • View Profile
How to add marker using camera's coordinates.
« on: May 06, 2020, 06:26:26 AM »
Hi and thank you for providing very good photogrammetry tool.

I am trying to add marker (GCP) to the chunk by Python API. However the problem is, even after converting the point of local x, y of the image to the chunk's coordinate system's point which is on the Camera , I cannot figure out the exact coordinates of the marker which also has the z (altitude) value.

Are there any good solutions for this?

To be simple, my question is,

1. Image's local x, y => The point on the Camera (Using Camera.center method)
2. The point on the Camera => Actual GCP marker's coordinates

#1 is succeeded but how about #2?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15163
    • View Profile
Re: How to add marker using camera's coordinates.
« Reply #1 on: May 07, 2020, 06:15:52 PM »
Hello koriel-angelswing,

The following sample should work similar to the guided marker placement available via GUI, when you right-click on the point of interest in the Photo view mode and use Add Marker option in order to create marker projections on all the images where the point of interest is visible.

Code: [Select]
camera = chunk.cameras[N]
point = surface.pickPoint(camera.center, camera.transform.mulp(camera.sensor.calibration.unproject(Metashape.Vector([x,y]))))
marker = chunk.addMarker(point)

If you need to get the 3D coordinates of the marker then in the reference coordinate system, you can get access to it via:
Code: [Select]
marker_coord = chunk.crs.project(chunk.transform.matrix.mulp(marker.position))
Best regards,
Alexey Pasumansky,
Agisoft LLC

forumname

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: How to add marker using camera's coordinates.
« Reply #2 on: September 07, 2022, 03:32:00 PM »
I am following up on this thread because the solution does not seem to work as I expect. After adding the marker through the API, I get the projection rays through the other cameras, but not the marker location projections. But if I add a marker in the GUI at the same location, I do get the markers in the other cameras. What additional steps are needed to get the marker in the other camera projections?

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15163
    • View Profile
Re: How to add marker using camera's coordinates.
« Reply #3 on: September 07, 2022, 07:11:37 PM »
Hello forumname,

what you are using as a surface for the pickPoint operation?
Best regards,
Alexey Pasumansky,
Agisoft LLC