Skip to content

support NEF/ARW/DNG raw formats and zero-padded image IDs - #130

Open
ManuelOsburg wants to merge 2 commits into
FireDynamics:masterfrom
ManuelOsburg:feature/raw-format-windows-compat
Open

ManuelOsburg wants to merge 2 commits into
FireDynamics:masterfrom
ManuelOsburg:feature/raw-format-windows-compat

Conversation

@ManuelOsburg

Copy link
Copy Markdown

Adopted and reworked from the annatroff/LEDSAwindows fork:

  • extend the raw format whitelist in image_reading by .NEF, .ARW and .DNG (rawpy reads them already; EXIF works with the existing exiv2 binding) and raise a clear ValueError for unsupported extensions instead of failing with UnboundLocalError
  • fix a path bug in ConfigData.get_start_time where directory and file name were concatenated without a separator inside os.path.join
  • add image_handling.format_img_name and use it wherever image names are built from the config template: plain {} placeholders now keep zero-padded IDs such as '0001' (DSC_0001.NEF), while numeric format specs like {:04d} still receive an integer

The int() casts previously applied before formatting broke camera series with zero-padded file counters. Unit tests cover the extension routing and both formatting paths.

Adopted and reworked from the annatroff/LEDSAwindows fork:

- extend the raw format whitelist in image_reading by .NEF, .ARW and
  .DNG (rawpy reads them already; EXIF works with the existing exiv2
  binding) and raise a clear ValueError for unsupported extensions
  instead of failing with UnboundLocalError
- fix a path bug in ConfigData.get_start_time where directory and file
  name were concatenated without a separator inside os.path.join
- add image_handling.format_img_name and use it wherever image names
  are built from the config template: plain {} placeholders now keep
  zero-padded IDs such as '0001' (DSC_0001.NEF), while numeric format
  specs like {:04d} still receive an integer

The int() casts previously applied before formatting broke camera
series with zero-padded file counters. Unit tests cover the extension
routing and both formatting paths.
Since 12b7e7d plain {} placeholders keep zero-padded image IDs, while
numeric format specs such as {:d} or {:04d} receive an integer. Two
places in ConfigData still called img_name_string.format() directly, so
templates with a numeric format spec failed there with a ValueError and
series with unpadded file names (img_1.jpg) could not be configured at
all. Use format_img_name in get_start_time and in_time_diff_to_img_time
as well.

The acceptance test images are named test_img_1.jpg etc. With the
zero-padded IDs the template test_img_{}.jpg pointed to test_img_0001.jpg
and every suite from S3 on failed. Use test_img_{:d}.jpg in the test
library, which is the template for unpadded file names.

(cherry picked from commit c0bbf50)
@ManuelOsburg

Copy link
Copy Markdown
Author

Hi Kristian,

I pushed one more commit to this PR (d674cee), because the change of the image IDs had two side effects:

  • Acceptance tests. Since plain {} placeholders keep the zero-padded ID, the template test_img_{}.jpg of the test library resolves to test_img_0001.jpg, while the generated images are test_img_1.jpg. Every Robot suite from S3 on failed. The test library now uses test_img_{:d}.jpg, the template for unpadded file names.
  • ConfigData. get_start_time and in_time_diff_to_img_time still called img_name_string.format() directly. Templates with a numeric format spec such as {:04d} failed there with a ValueError. Both now use format_img_name.

Tests: unit tests pass, and Robot suites 02–06 pass. S1 fails on Windows independently of this PR; I'll open a separate issue for it.

One point to decide: existing configs that use {} with unpadded file names (img_1.jpg) need {:d} after this PR. If you prefer to keep them working unchanged, format_img_name could fall back to the unpadded name when the padded file does not exist. Let me know and I'll add that.

Best,
Manuel

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant