Code Monkey home page Code Monkey logo

Comments (9)

esoha-nvidia avatar esoha-nvidia commented on June 15, 2024

I have made the fix already here. If you like, I can make one for you, too, and perhaps add a test to prove it.

from imagecodecs.

cgohlke avatar cgohlke commented on June 15, 2024

Thanks for the report. I can apply the patch but a test or image would be useful.

from imagecodecs.

cgohlke avatar cgohlke commented on June 15, 2024

There is a more actively maintained version of lj92 at https://github.com/ilia3101/MLV-App/blob/master/src/mlv/liblj92/lj92.c. It seems to include a fix for this issue. Can you confirm? I'll probably switch to that source.

For reference, there's yet another version at https://github.com/syoyo/tinydng/blob/master/tiny_dng_loader.h#L480

from imagecodecs.

esoha-nvidia avatar esoha-nvidia commented on June 15, 2024

Why do you say that it seems to include a fix? Where is that fix?

from imagecodecs.

esoha-nvidia avatar esoha-nvidia commented on June 15, 2024

I see it now: ilia3101/MLV-App@170ec64

Yup., that's the issue. I don't know if the fix is correct but it might be.

from imagecodecs.

esoha-nvidia avatar esoha-nvidia commented on June 15, 2024

How do you run tests on this repo? If you have unit testing, I can provide a file that you can use for your testing.

I tried this but it didn't work:

python3 setup.py test

from imagecodecs.

cgohlke avatar cgohlke commented on June 15, 2024

How do you run tests on this repo?

Run python -m pytest tests after an inline build or run test_imagecodecs.py directly. Anyway, building imagecodecs is not straightforward.

I can provide a file that you can use for your testing.

Yes, please.

After applying ilia3101/MLV-App#221 and some other changes, I am now able to read most LJPEG files I could find (not that many).

from imagecodecs.

esoha-nvidia avatar esoha-nvidia commented on June 15, 2024

From the URL https://www.kaggle.com/competitions/rsna-breast-cancer-detection/data you can download a large dataset which includes the file 9989/439796429.dcm which has inside of it an LJ92 file which I have saved as
439796429. (Trying to download and decode the dataset yourself will be a pain.)

I can confirm that, in my code, this file does not work with the old lj92 but it does work after applying something similar to ilia3101/MLV-App#221 (we did it a different way but it's the same idea).

Can you confirm that your code, on the above file, is not working without the change and then working after it?

Before the change, the first few pixels were incorrectly:

23405
23411
23411
23411
23411
23411
23411
23411
23411

After the change, the first few pixels are:

0
0
0
0
0
0
0
0

Also, from where you do have other lj92 files? We'd like to try them out, too!

from imagecodecs.

cgohlke avatar cgohlke commented on June 15, 2024

Thank you for the test image. I have made several changes to the vendored lj92.c file in imagecodecs and can confirm that it can now correctly decode your test image.

Also, from where you do have other lj92 files? We'd like to try them out, too!

I usually extract them from DNG and DCM files "found on the internet".

I am attaching the current test images and lj92.c code: ljpeg.zip

from imagecodecs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.