Giter Site home page Giter Site logo

Comments (9)

B-LechCode avatar B-LechCode commented on June 9, 2024 1

Yes 16 Bit images often don't use the full dynamic range, resulting in completely black or white 8 Bit images when scaled to the data type min/max.

from oculante.

woelper avatar woelper commented on June 9, 2024

Thanks! When you say 16-bit grayscale images, could you elaborate a bit more? Oculante should be able to open 16-bit grayscale images. If I am reading it right, you want to influence / map how these images are displayed on the display?

Could you maybe add a screenshot / video showing how Fiji does it?

from oculante.

janroden avatar janroden commented on June 9, 2024

Thanks for the fast response and the interest :)

By 16-bit grayscale, I just mean a 2D array of uint 16-bit values stored as TIFF for instance (I attached an example TIFF image file. Sorry, I had to zip the file, because GitHub doesn't seem to support attaching TIFF directly).

Oculante should be able to open 16-bit grayscale images.

Ah ok, nice, that would be great :) I assumed that it doesn't support it, because I tried to open the attached example TIFF in Oculante and it only showed a black image without content, so I assumed it doesn't work. But maybe it expects a certain header / info in the TIFF? Or I should have adjusted the brightness / color range somewhere? (Sorry I'm not experienced with Oculante yet).

If I am reading it right, you want to influence / map how these images are displayed on the display?

I just meant, since it's 16-bit, the full color depth can't be shown on the screen at once, so you need to be able to select somehow which part of the 16-bit range should be shown. And for this selection, it's often useful to combine this with a histogram of the image, so that you can see what part of the bit range you're selecting relative to the histogram of the image.

Could you maybe add a screenshot / video showing how Fiji does it?

Sure thing. In Fiji, you can go to "Image" > "Adjust" > "Brightness / Contrast" (or press Ctrl + Shift + C). Then you have a small separate "B&C" window popping up, where you can see the histogram of the image in the background, and when you move the "Minimum" and "Maximum" sliders, you can set the range of the histogram you want to see, e.g. everything between pixel intensity 122 to 1400. (maybe in Fiji it's actually a bit more complicated than needed)

image

example_1.tiff.zip

from oculante.

woelper avatar woelper commented on June 9, 2024

Great, thanks! Also very nice of you to attach a sample image!

For lots of "HDR" file formats like yours, I usually map them into the visible range somehow. This is especially useful in the movie/game industry where image data has a greater range than your display. I had a look and I don't do that for tiff yet which have more than 8 bits.

As a short-term fix, I could so automatic mapping based on min/max values and compress them into 8 bits.

Long-term, I am planning for Oculante to preserve the bit depth until the point where the image is displayed. Now, every image is converted to RGBA/8bpp when loaded, so the additional data is lost. I would love a 16 or 32 bit image to be loaded as that, so you have the option to apply any filter you like. At that point, you could probably replicate what you wrote above.

from oculante.

B-LechCode avatar B-LechCode commented on June 9, 2024

@woelper I think a min/max mapping for everything else than 8bit is a good idea.
For industrial imaging, this approach is widely used: https://www.mvtec.com/doc/halcon/13/en/disp_image.html

I had the same problem, and additionally a similar problem with not normalized float images.
Some info about the scaling, displayed in the UI could be a good idea, too.

from oculante.

woelper avatar woelper commented on June 9, 2024

Thanks! I am doing some basic tone mapping on >8 bit images already (png for example). I'll have a look at the link you provided.

I have started a branch for loading and preserving float images a long time ago, but I want to revisit how I handle them. Initially, I loaded everything as float but that results in excessive memory consumption. My idea is that instead of passing around RbgaImages, I want to load every format into a DynamicImage enum and then draw based on the image type. The filter operators mostly operate in float already, so you could apply a "levels" or brighness operator and scale the image as needed.

from oculante.

woelper avatar woelper commented on June 9, 2024

I've looked at it today - it seems I already do a simple mapping per value here (

tiff::decoder::DecodingResult::U16(contents) => {
debug!("TIFF U16");
ldr_img = contents
.par_iter()
.map(|p| fit(*p as f32, u16::MIN as f32, u16::MAX as f32, 0., 255.) as u8)
.collect();
) - although it is not very smart. But as I see it, each value should be transformed into 8 bit range. If I understand the above suggestion correctly, a better option would be to run a pre-pass and get the absolute max and min, then map the image?

from oculante.

woelper avatar woelper commented on June 9, 2024

I think this looks much better - using a pre-pass to determine the darkest/brightest values:

image

from oculante.

woelper avatar woelper commented on June 9, 2024

I merged the above and released a new version - let me know if that improves things!

from oculante.

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.