Repository navigation
Commit 92381be
Add unit tests for opensfm exif
Summary:
Adds `test_exif.py` to the existing opensfm pytest target, covering `opensfm/exif.py`, which had about 61% unit test coverage. The `EXIF` class is constructed through its real constructor (exifread plus XMP parsing) on synthetic byte streams, and the parsed tags are then injected per test.
Behavior covered:
- rational and GPS helpers: `eval_frac` (division by zero), `gps_to_decimal` (N/S/E/W signs), `get_tag_as_float`
- `compute_focal` from the 35 mm equivalent, from focal length plus sensor width, and from the sensor database
- `sensor_string` and `camera_id` formatting
- XMP: `get_xmp`, `parse_xmp_string`, `unescape_string`, and `get_gpano_from_xmp`, including missing and unparseable XMP
- image size from EXIF, Image tags, or the loader; make/model decoding (lens versus body, invalid UTF-8); orientation
- `extract_sensor_width` for every resolution unit, the Y-resolution fallback, and invalid values; `extract_focal` via sensor width
- `extract_geo` from GPS tags (refs, negative altitude ref, DOP, altitude cap, defaults) and from DJI XMP
- `extract_capture_time` from the GPS stamp, the DateTime fallback with sub-seconds and a timezone offset, an invalid offset, and a missing timestamp
- `extract_opk`: DJI gimbal angles match the equivalent Camera Yaw/Pitch/Roll after the +90° pitch offset, yaw changes kappa, and missing or invalid inputs return `None`
- `extract_exif` and `extract_exif_from_file` end to end, including OPK
- `hard_coded_calibration` (MODEL and ALL entries, unknown model or make), the focal-ratio, focal-xy, and default calibrations, and `calibration_from_metadata` per projection family
- `camera_from_exif_metadata` for all supported projection types, the default calibration path, and the unknown-projection error
___
landed-with-radar-review
Differential Revision: D125292550
fbshipit-source-id: 1266b2c92b0d9d3c57a0292c1d10b66bdffa958d1 parent d257f4f commit 92381be
1 file changed
Lines changed: 441 additions & 0 deletions
0 commit comments