Forum

Author Topic: How to get Marker coordinates  (Read 10413 times)

stijntje44@hotmail.com

  • Newbie
  • *
  • Posts: 7
    • View Profile
How to get Marker coordinates
« on: April 23, 2019, 03:44:21 PM »
I've been trying to get the coordinates of markers through python.
After detecting the markers I have the following code

for c in chunk.markers:

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15163
    • View Profile
Re: How to get Marker coordinates
« Reply #1 on: April 23, 2019, 04:01:42 PM »
Hello stijntje44,

Do you need to get the coordinates of the marker projections on the individual images or a position of the marker in 3D space?
Best regards,
Alexey Pasumansky,
Agisoft LLC

stijntje44@hotmail.com

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: How to get Marker coordinates
« Reply #2 on: April 24, 2019, 09:23:50 AM »
Hi

I didn't realize this comment was actually posted, as you can perhaps tell, it was cut off halfway through because I actually managed to fix the issue while writing the post.

Thanks a lot for the help though.

For anyone trying to do the same thing:

   for m in chunk.markers:
      locAll = m.position
      print("The location of ", m, "is", locAll)

In the end, this worked, before this, I tried with several combinations of " chunk.reference.position" and other variations on that, which always gave me a [0, 0, 0]  result, or none.
« Last Edit: April 24, 2019, 09:25:37 AM by stijntje44@hotmail.com »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15163
    • View Profile
Re: How to get Marker coordinates
« Reply #3 on: April 24, 2019, 01:18:48 PM »
Hello stijntje44,

chunk.markers[0].position returns the coordinate of 3D point in the internal coordinate system.

If there's a need to get the coordinates for the georeferenced chunk in real world coordinate system, then additional transformations are required:
Code: [Select]
marker = chunk.markers[0]
coord = marker.position
T = chunk.transform.matrix
crs = chunk.crs

output  = crs.project(T.mulp(coord))
Best regards,
Alexey Pasumansky,
Agisoft LLC

mmacferrin

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: How to get Marker coordinates
« Reply #4 on: April 24, 2019, 09:48:04 PM »
Hello, Alexey or anyone else knowledgable of this: I have a follow-up question related to this post.

After generating a point cloud, I'm able to retrieve the coordinates of each tie-point, in both internal-coordinate space and projected coordinates, which is great. Beyond that, how do I retrieve the keypoint locations on each image, that the tie-points came from?  I am needing to get the original pixel coordinates on the images that each tie-point was derived from, but I haven't yet found how to get that information. I'm looking through the manual and API-tutorial but not finding it.

This is using Agisoft Photoscan Pro 1.4.5 on Ubuntu linux.

Let me know, and thanks so much!

- Mike

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15163
    • View Profile
Re: How to get Marker coordinates
« Reply #5 on: April 25, 2019, 09:53:33 PM »
Hello Mike,

You need to access the projections of the tie points.

Please check if this script example does solve the required task.
Best regards,
Alexey Pasumansky,
Agisoft LLC

mmacferrin

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: How to get Marker coordinates
« Reply #6 on: April 26, 2019, 02:09:26 AM »
Alexey, I haven't run it yet, but looking through your script, getting the Camera matrices and the Calibration matrices, inverting them and converting it through each of those back into image-pixel space, appears to be exactly what I need. Thank you so much!

I'll post here if I have trouble running it, your help is much appreciated.

- Mike

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15163
    • View Profile
Re: How to get Marker coordinates
« Reply #7 on: April 26, 2019, 01:44:57 PM »
Hello Mike,

The locations of the tie points in 3D space are defined by the coordinates of their projections on 2D images. This information is stored in the project and can be access quite easily via Python.

Just a little more complicated is the process of projecting the 3D point (with some arbitrary coordinates) on the source images to get the projections coordinates of the point on for the relevant cameras.
Best regards,
Alexey Pasumansky,
Agisoft LLC

gilrito

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: How to get Marker coordinates
« Reply #8 on: May 12, 2019, 01:40:34 PM »
Dear all,
I'm trying to get the 3D coordinates of the markers using the above script. Unfortunately i get the following error:
RuntimeError: Vertical datum missing
Any help will be grateful.
Gil

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15163
    • View Profile
Re: How to get Marker coordinates
« Reply #9 on: May 12, 2019, 02:22:44 PM »
Hello Gil,

If you are using compound coordinate system for the chunk georeferencing, you should have the corresponding GeoTIFF file in the /geoids/ folder. So id doesn't seem to be a script issue.
Best regards,
Alexey Pasumansky,
Agisoft LLC

lyhour

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: How to get Marker coordinates
« Reply #10 on: January 13, 2022, 04:09:18 PM »
Dear Alexey,

This post is long time ago, I hope that you can reply me related to this issue. I need both the coordinates of the marker projections on the individual images and position of the marker in 3D space. How can I get it in Metashape 1.70. Thank you very much.

Best Regards,

CHHAY LYHOUR

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15163
    • View Profile
Re: How to get Marker coordinates
« Reply #11 on: January 29, 2022, 07:34:44 PM »
Hello lyhour,

Please provide the example, of what you have on input for each marker.
Best regards,
Alexey Pasumansky,
Agisoft LLC

above_naveen

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: How to get Marker coordinates
« Reply #12 on: December 13, 2022, 08:24:33 PM »
Hello Alexey,

I am also looking for a similar at a similar problem. I have 8 real-world marked GCPs which are added to the project from a csv file and both photos and markers are converted to local geoid representation(EPSG569). I want the image pixel coordinates of these markers.
 

Thanks for your help.

Naveen Kumar