localdevices / pyorc

Surface velocity, object tracking, and river flow measurements in an open-source API
GNU Affero General Public License v3.0
129 stars 31 forks source link

how to input GPS Coordinates in GCPs #85

Closed riddle911 closed 1 year ago

riddle911 commented 1 year ago

hi, I noticed that in the Quickstart tutorial, the gcps belong to Plane Rectangular Coordinate System, is it possible to directly input gps coordinates, as it in the OpenRiverCam project.

hcwinsemius commented 1 year ago

Yes you can. The user guide will describe this, and is currently being produced. You can simply add a keyword crs to the gcps to do this. Following the example section, you could for instance add lat-lon coordinates as follows:

gcps["crs"] = 4326  # EPSG code for WGS84 lat-lon
gcps["dst"] = [ ... ]  # and then a list of lists with x, y being lon, lat

And then serve the gcps in the same way.

cam_config = pyorc.CameraConfig(gcps=gcps, crs=32735)

Now the camera config is still in UTM 35S, but the coordinates in the gcps will be on the fly transformed from EPSG:4326 to EPSG:32735. If you do not provide crs then the assumption is made that coordinates are in the same projection system as the camera config. In this same way you can also provide a cross section when you extract a transect from your results with get_transect.

You can also set (or update) the gcps later using cam_config.set_gcps. See https://localdevices.github.io/pyorc/_generated/pyorc.CameraConfig.set_gcps.html

Let me know if you have any further issues or if this is solved. Then I can close the issue.

riddle911 commented 1 year ago

Thank for reply. I have tried to transform lat-lon coordinates to X-Y using python package named utm, and set it to X-Y gcp manually, now I'll try the way you mentioned. Thanks again, such great work!

hcwinsemius commented 1 year ago

@riddle911 we have just released 0.3.1 which has the ability to provide 3D coordinates instead of one horizontal plane. If you have 6 or more points that cover all the dimensions then the perspective can be resolved with that. So a cor er point on a bridge deck, a traffic sign or anything else can in principle serve as control point.

We also resolved a number of bugs.

If you got things working can you please let us know in this issue? Then I can close it.

hcwinsemius commented 1 year ago

I am assuming this issue is resolved. If you have any further issues, please post a new issue with clear instructions and code examples to demonstrate your issue.