Forum

Author Topic: Markers are slightly off  (Read 1642 times)

colin.spexigeo

  • Newbie
  • *
  • Posts: 13
    • View Profile
Markers are slightly off
« on: April 02, 2019, 09:16:47 PM »
Hi there,

I'm attempting to automatically add GCP markers via script. The user provides a list of GCP latitude/longitude/elevation values, and the script will ingest it and add markers, then send back the projections to an API so the user can verify and modify them. I've hit a snag with my script that adds the markers, however. The markers I add via the coordinates are slightly off (rotated)

To demonstrate this, I have this script that will attempt to add a marker at the exact spot that the cameras are according to their reference data.

Code: [Select]
chunk = Metashape.app.document.chunks[0]

# Take in WGS84 point and project it into the chunk
def add_marker(point):
    p = chunk.crs.unproject(point)
    p = chunk.transform.matrix.inv().mulp(p)
    chunk.addMarker(p)

for camera in chunk.cameras:
    add_marker(camera.reference.location)

If the script is working correctly, then the markers would be overlapping with the camera positions. However, they are not, as you can see in the attached photo. All I had done with this chunk previously was add and align the photos.

Any help with this is appreciated!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Markers are slightly off
« Reply #1 on: April 02, 2019, 10:32:25 PM »
Hello colin.spexigeo,

Do I get it correctly, that you have the list of XYZ (Lat/Long/Alt) values and you would like to create the markers in these locations and back-project them on the aligned cameras?

Have you checked manually, that camera alignment is correct? With DJI you may have camera altitude values lower than marker's elevations.
Best regards,
Alexey Pasumansky,
Agisoft LLC

colin.spexigeo

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Markers are slightly off
« Reply #2 on: April 02, 2019, 11:04:11 PM »
Hi Alexey,

Yes, that's essentially what I'm trying to do. I am also running a script that adjusts the reference altitude of the cameras based on the DJI metadata prior to initial camera alignment (forgot to mention this):

Code: [Select]
        for camera in chunk.cameras:
            if 'DJI/RelativeAltitude' in camera.photo.meta.keys() and camera.reference.location:
                z = float(camera.photo.meta['DJI/RelativeAltitude'])
                camera.reference.location = (camera.reference.location.x, camera.reference.location.y, z)

However it doesn't seem to be an altitude problem, otherwise the markers would simply be above/below the corresponding camera positions, unless I'm misunderstanding something fundamental here.

EDIT: Just ran another little test to verify I'm not going crazy here.

Code: [Select]
> campos = chunk.cameras[0].transform.translation()
> p = chunk.transform.matrix.mulp(campos)
> p = chunk.crs.project(p)
> p
Vector([-123.01777296919887, 49.14079153544101, 68.74203079824663])
> chunk.cameras[0].reference.location
Vector([-123.018551851397, 49.141292174004, 68.7])

Note that the projected values are significantly different. So this seems to confirm that the camera translations are *not* where the camera reference info says they are. Why would this be? Am I missing a step somewhere?
« Last Edit: April 02, 2019, 11:16:40 PM by colin.spexigeo »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: Markers are slightly off
« Reply #3 on: April 03, 2019, 06:40:43 PM »
Hello colin.spexigeo,

Can you send the project with the alignment results and the CSV file with the markers' locations to support@agisoft.com?

If you are observing the large error values on the camera locations after alignment, it could be related, for example, to the incorrect calibration data estimation or to the utilization of the camera orientation angles that are not correct.
Best regards,
Alexey Pasumansky,
Agisoft LLC