OpenDroneMap / WebODM

User-friendly, commercial-grade software for processing aerial imagery. 🛩
https://www.opendronemap.org/webodm/
GNU Affero General Public License v3.0
2.89k stars 961 forks source link

Possible bug: Basic exif-tags not read after resizing images. #1155

Open atobiese opened 2 years ago

atobiese commented 2 years ago

Hi! For some datasets, the exit-tags are not readable after image resizing.

[WARNING] Cannot read basic EXIF tags for /var/www/data/116a5dfd-a189-4e01-8cdb-5c53758ebbee/images/DSC00430.JPG: string index out of range

The try catch appears in the photo.py script, openmv. I have not been able to check why the tags are modified.
It is correctly read when no resizing is done. I have seen this using a workflow involving explicitly tagging images from RTK-gps data. I will be able to share images, but will have to find a few that reproduces the errors, and may take a bit of time.

pierotofy commented 2 years ago

Hi @atobiese,

It looks like there is some information missing from your issue that will be needed in order to diagnose and fix the problem at hand. Please take a look at the Issue Template, which will tell you exactly what your issue has to contain in order to be processable.

Also, double check that this is the right place. If you are just asking for information, reporting feedback or proposing a few feature, the right place to ask is the Community Forum, not here.

I'm marking this one now as needing some more information. Please understand that if you do not provide that information within the next week (until 2022-03-16 04:45) I'll close this issue so it doesn't clutter the bug tracker.

Cheers! ~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

atobiese commented 2 years ago

How did you install WebODM (docker, installer, etc.)?

this is a docker install on windows, but the problem also appears on Ubuntu /with docker.

What's your browser and operating system? (Copy/paste the output of https://www.whatismybrowser.com/)

Chrome 99 on Windows 10

What is the problem?

please see above

How can we reproduce this? (What steps trigger the problem? What parameters are you using for processing? Include screenshots. If you are having issues processing a dataset, you must include a copy of your dataset uploaded on Dropbox, Google Drive or https://dronedb.app)

From the exif data, values for "GPS Latitude Ref" and "GPS Longditude Ref" are lost in the resizing process, ie, it shows "Unknown ()" image

odm/photo.py: if 'GPS GPSLatitude' in tags and 'GPS GPSLatitudeRef' in tags: self.latitude = self.dms_to_decimal(tags['GPS GPSLatitude'], tags['GPS GPSLatitudeRef']) if 'GPS GPSLongitude' in tags and 'GPS GPSLongitudeRef' in tags: self.longitude = self.dms_to_decimal(tags['GPS GPSLongitude'], tags['GPS GPSLongitudeRef'])

I have not set up a dev environment, so haven't looked at the resize function. thanks!

atobiese commented 2 years ago

The following external bug fixes the error. https://github.com/atobiese/Piexif/commit/a58dee150c574c1c42b428631249b51e2151331f

It's located in Piexif and the error appears when parsing exif data during loading (which is then dumped back after resizing in ODM).
photo.py requests GPSLatitudeRef and GPSLongitudeRef for decimal degree calculation. https://github.com/OpenDroneMap/ODM/blob/2e87505ce7e026c8fcee527a6524cdcbb7a6ec09/opendm/photo.py#L210

The problem is that piexif seems stale. So the question is how to resolve this.

The problem occurs as these values were erased, none of the image sets failed (georeferencing) after resizing.

pierotofy commented 2 years ago

Ah, good find! Thanks for looking into this :pray:

I would recommend to open a pull request in the piexif repository; then once a new version for piexif is released we can upgrade it in WebODM. That would be the easiest way.

atobiese commented 2 years ago

Sounds like a good plan:) I've opened the PR and hopefully it will get merged in soon.