Pixel values being clamped

I'm using LibRaw (through FreeImage, though that could change if necessary) to get the pixel data from raw images which then have effects applied to them, e.g. exposure, white balance.

This works well, except if I understand correctly the pixel values are scaled using black and white levels to the range 0-65535 with values outside the range effectively lost. Is it possible with LibRaw to keep the values between the black and white levels?

What I want to do is end up with the values as floating point numbers, where the black point is 0 and the white point is 1, but allow values outside this range (for recovering highlights).

Forums: 

imgdata.params.no_auto_bright

imgdata.params.no_auto_bright=1 will, most likely, solve the problem.
Not sure it is possible to set via FreeImage

-- Alex Tutubalin

Thanks for the response. It

Thanks for the response. It looks like FreeImage already sets that flag. But I think I was misunderstanding anyway. I thought that because (for a 12 bit image) the maximum wasn't 0xfff, but was 0xf00 which was then scaled to 0xffff that the data was being discarded. From a closer look at the source it looks like this is just because the black level (0xff) is subtracted.

Therefore it looks like the only way to "recover" the highlights is to use a method similar to libraws recover_highlights method. Unfortunately I need to do this after the data is converted to rgb, and if I understand correctly the recover_highlights method works on all four channels (though I'm not really sure what the variables kc and hsat are, and what the difference between kc and c is, if you could explain this I'd be thankful). Are you aware of any methods that work on 3 channel rgb data?

clipping is necessary to

clipping is necessary to avoid 'pink clouds' problem

-- Alex Tutubalin