OpenDroneMap / ODM

A command line toolkit to generate maps, point clouds, 3D models and DEMs from drone, balloon or kite images. 📷
https://opendronemap.org
GNU Affero General Public License v3.0
4.91k stars 1.11k forks source link

Adding TIFFTAG_* to .tif outputs #1797

Closed stephenwinn16 closed 2 months ago

stephenwinn16 commented 3 months ago

Following up on #1793, I've added steps to the orthophoto and DSM/DTM generation to be able to include TIFFTAG information. In the current commit, I've hardcoded a datetime for testing purposes. I would like this to be replaced by a mean capture time based on the input image metadata (such as the "Capture Start" and "Capture End" that appear e.g. in the PDF report). Would anyone be able to point me to a good place to pull them from during the processing pipeline?

Additionally, is the ODM version stored somewhere during the processing pipeline? Or should it always be read from the VERSION file as in run.py?

pierotofy commented 3 months ago

Thanks @stephenwinn16, note we should probably set the tags in/around https://github.com/OpenDroneMap/ODM/blob/master/stages/odm_postprocess.py#L38 similarly to how we set GCPs metadata.

You could find the precomputed start/end dates in odm_report/stats.json, but you have to be careful, because if a report is not generated (when --skip-report is used) the file might not be there. If not, you'll have to recompute from utc_time https://github.com/OpenDroneMap/ODM/blob/master/opendm/photo.py#L130 as a fallback.

Yes version is stored in VERSION. I would just re-read it, or create a function to read it and then optionally memoize it.

stephenwinn16 commented 2 months ago

Thanks @pierotofy for the comments. I've moved the lines into the odm_postprocess step and read the time information either from the odm_report/shots.geojson file or the images.json file depending on what exists.

Do you see any other useful information to include with the TIFFTAG fields?

pierotofy commented 2 months ago

Thanks @stephenwinn16, I've made some changes to simplify the logic and avoid reading files from disk, I realized we already had a function to read the ODM version and that it was probably faster to read the UTC time from the photos object which is already in memory, I'll run some more tests and merge this shortly. :pray:

stephenwinn16 commented 2 months ago

Great, more efficient and much cleaner, thank you @pierotofy !