image-rs / imageproc

Image processing operations
MIT License
755 stars 148 forks source link

Update `image` to 0.24 #491

Closed okaneco closed 2 years ago

okaneco commented 2 years ago

I've broken out the commits to hopefully make it easier for review.

Closes #485


3f2f0979c663ff8e32e71a95b19f3a3710bed582, 9fb0ea387421b642f589fe683f68fed744853496

image 0.24 removes the Bgr and Bgra pixel types https://github.com/image-rs/image/pull/1482

'static was largely removed from traits and impl bounds so it's removed here https://github.com/image-rs/image/pull/1597

e501161e40d33b8d6079b91dafbeb82343b12410

Main bulk of changes for migration work

Some trait bounds needed to be added to src/integral_image.rs and src/map.rs functions since a sealed trait Enlargeable was added to the Rgb/Rgba definitions https://github.com/image-rs/image/pull/1651

The following seems to satisfy the requirements.

    Rgba<T>: Pixel<Subpixel = T>,
    T: Primitive,

2a3c5c0010487570bd07903ba2e7446eaf2357af

GenericImage::get_pixel_mut is deprecated in 0.24 so I've replaced the two occurrences of it.

61f4863003dd2b1165098e537a92820a15b29196

Replaced regression truth image files.

4 regression tests failed likely due to changes made in Luma calculation to minimize floating point errors https://github.com/image-rs/image/issues/1214.
The failure error output can be read below in the contracted view. The differences are fairly small.

27 of the files changed are truth files from regression tests being regenerated. In test_match_histograms, the center pixel at (177, 170) doesn't match.

Failed regression tests ```bash failures: ---- test_gaussian_blur_stdev_3 stdout ---- thread 'test_gaussian_blur_stdev_3' panicked at 'pixels do not match. location: (13, 6), actual: 209, expected: 208 location: (13, 7), actual: 210, expected: 209 location: (11, 10), actual: 212, expected: 211 location: (13, 10), actual: 212, expected: 211 location: (0, 11), actual: 213, expected: 212 ', tests\regression.rs:123:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ---- test_match_histograms stdout ---- thread 'test_match_histograms' panicked at 'pixels do not match. Actual: 175 176 177 178 179 +-------------------------- | 168| 102 150 150 156 165 | 169| 29 54 67 85 110 | 170| 31 58 75 106 126 | 171| 28 40 54 85 97 | 172| 47 50 62 75 75 | Expected: 175 176 177 178 179 +-------------------------- | 168| 102 150 150 156 165 | 169| 29 54 67 85 110 | 170| 31 58 71 106 126 | 171| 28 40 54 85 97 | 172| 47 50 62 75 75 | ', tests\regression.rs:123:9 ---- test_gaussian_blur_stdev_10 stdout ---- thread 'test_gaussian_blur_stdev_10' panicked at 'pixels do not match. location: (29, 1), actual: 98, expected: 97 location: (23, 2), actual: 135, expected: 134 location: (10, 3), actual: 190, expected: 189 location: (0, 5), actual: 201, expected: 200 location: (5, 5), actual: 198, expected: 197 ', tests\regression.rs:123:9 ---- test_sobel_gradients stdout ---- thread 'test_sobel_gradients' panicked at 'pixels do not match. location: (78, 135), actual: 31, expected: 30 location: (79, 135), actual: 31, expected: 29 location: (80, 135), actual: 57, expected: 55 location: (78, 136), actual: 69, expected: 67 location: (80, 136), actual: 41, expected: 39 ', tests\regression.rs:123:9 failures: test_gaussian_blur_stdev_10 test_gaussian_blur_stdev_3 test_match_histograms test_sobel_gradients test result: FAILED. 23 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out ```

cf3bec110997a1d412ad67ec61be32bcca2a7693

I noticed that I added the bound but it wasn't needed due to Enlargeable not being added to the Luma color define macro definitions in image.

theotherphil commented 2 years ago

Fantastic, thanks! Is this ready for review and merge now?

okaneco commented 2 years ago

Yes, it is :+1: