Project ground control point to image

The topic is originally posted on opensfm (#915), but I didn’t get an answer for a few days. I think I may get some help here.
Basically, I want to project ground control point to image to get the pixel coordinates of the control point. I believe this can relieve people from picking the gcps on the image one by one. Although there are some great work(e.g. Find_GCP ) on automatically detecting gcp with some patterns, but not all the gcps have these patterns, so it may fail.
Below are my findings for these days:

First, we need to transform the gcp coordinates to WGS84, we can get lat, lon, alt. Then use the following code to project the ground control point to image.

pt3D= reference.to_topocentric(lat,` lon, alt)
pt2D= shot.project(pt3D)
pt2D_px = cam.normalized_to_pixel_coordinates(pt2D)

then check if the pt2D_px is inside the camera frustum.
I only have one problem here is that the altitude of `pt3D` is NOT right, resulting in the wrong `pt2D_px `. But I don't know how to get the right altitude since the reference altitude is set to 0 in function `invent_reference_from_gps_and_gcp` of `dataset.py`, and the height of ground control point ususally near 0, so we always get ~0 altitude of pt3D.
I checked the point altitude of reconstruted point cloud using Meshlab. The point altitude has a value of -90 ~ -70 m。If we use this altitude to project gcp to image, we can get the right coordinates.
So how can I get the right altitude when transform the gcp to topocentric?

Thank you for your time.

1 Like

Welcome!

This looks really interesting.

How do you envision this working (within?) the context of OpenDroneMap? A plugin? An upgrade to POSM GCPi? Feature for GCP Editor Pro (which has proximity-based image pre-filtering)?

I think it could be a plugin for webodm, and be integrated into SFM routine. What do you think?

1 Like

Ahh, unfortunately I don’t understand things well enough to have an informed comment. Hopefully someone stops by shortly who can share a bit more insight with us.

It’s ok, thank you.

1 Like

The reference can be treated as offsets of the coordinates (not exactly true, but you get the idea), the 0 ref altitude means it won’t offset the input elevation much if the points are closed to the reference lat lon.

The problem is why your gcps have altitudes near 0 but your model has altitude -90 ~ -70. You might want to check the gcp errors first. The gcp_errors are calculated by this, it also uses reference.to_topocentric

1 Like