How to obtain bit depth?

Hey,

I need to analyze and normalize a given RAW-Picture, but the program needs to work for 12 and 14bit cameras. When I use the imgdata.image field, I don't know whether I have to divide by 4096 or 16384. I searched the forum, documentation and sample files, but couldn't really find anything. Is there any way to solve my problem apart from just guessing that I have a 14bit because some values are larger than 4096?

bye, Peter

Comments

You may rely on imgdata.color.maximum field.

It seems that sometimes black is subtracted from imgdata.color.maximum and sometimes it isn't. Perhaps I'm not reading the source correctly, as I'm new to this project.

To have imgdata.color.maximum accurately reflect the range of my data, should I also subtract black from imgdata.color.maximum? If not, is it always pre-subtracted? If not, how can I tell when it is and when it isn't?

More details:

In LibRaw::unpack() call, color.maximum is set according to metadata (for DNG and other formats with maximum value in metadata) and/or to camera default if no metadata present.
Also, color.channel_maximum[] is set by *real* image data (real maximum in given channel).

The LibRaw::subtract_black() call recalculates channel_maximum[] for entire image and adjusts color.maximum by common black level.

The subtract_black() is called on postprocessing stage, or may be called by LibRaw user.

The black level subtraction is perfomed on postprocessing stage or by call to subtract_black().

The maximum value is adjusted when subtraction is made.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.