How do I get the "rawest" data possible?

Hello,

I have a question concerning the unpack()-Method. I read in the API documentation that the black level may or may not be calculated and subtracted and some other things might happen during unpacking as well. What do I do to get the rawest data possible? Should I calculate the blacklevel manually from the masked pixels and add it back to all pixels? Also, when using the imgdata.color.maximum field, I get a value of 15600 for a 14bit file format (Camera: Canon Mark II 5D) which should be 16384? It is very important for me to have access to the most unprocessed data and I would be very happy if you knew the answer to this problem.

bye, Peter

Comments

So far I tried setting the following parameters, similar to unprocessed_raw.cpp:

OUT.document_mode=2;
OUT.output_bps=16;
OUT.user_flip=0;
OUT.no_auto_bright = 1;
OUT.filtering_mode=LIBRAW_FILTERING_NONE;

Of course I set these before calling open_file and unpack. In addition, the reason I found out about this was that I used two sets of pictures, one shot with ISO400 and one with ISO800 and basically illuminated a spot with a damped laserpointer (in a dark room). I wanted to calculate the exposure time that I need to saturate one of the channels. I noticed that the maximum value I could get for ISO400 was above 14500, while for the ISO800 I couldn't get the value above 13000 which doesn't make sense to me, since the wavelength of the laser didn't change and only the ISO setting was increased.

bye, Peter

Yes, amplifier+ADC combo works this way. On my 5Dmk2 I've two different 'maximum' values, one for normal ISOs and one for 'High' ones.

Anyway, there is two different questions
- maximum possible value (2^(bit depth) minus dark current). This value is data format/camera dependend, you may rely on imgdata.color.maximum field
- maximum value for given shot. In general, you should scan entire image are to calculate it.

Hey,

thank you very much for your answer. I implemented an averaging of entries for the fields top and left. Oddly, it is the same for ISO400 and ISO800 (1058). I am not sure if I understood something wrong, but I expected a much larger value to account for the difference in maximum pixel value for the ISO800 picture. My results so far are: The laserpointer is bright enough and the exposure time high enough to drive at least the green channel into saturation.
When I use the imgdata.color.maximum field, I get the value 15600 for ISO400 and for ISO800, which is about what I expected and not a problem for my application.
When I scan for the maximum value in any channel, I get 15760 for the ISO400 (close enough to 15600 I think) but only ~12811 for the ISO800. This is what I do not understand because masked_pixels buffer contain almost the same values.
Also, I tried to access the ph1_black but I think it is not allocated in my case, at least something like

rawProcessor.imgdata.masked_pixels.ph1_black[1][0]

threw an error. If the 12811 for ISO800 is the other maximum value as you suggested then it is a problem because when my application works, my goal is to not drive the channel into saturation but to use maybe 80% of the maximum saturation. Do you have any idea about why the black levels are the same and if the 12811 is the maximum value you suggested is used for high ISO settings or what I can do to solve this issue?

bye, Peter

First. ph1_black is the data field for PhaseOne black data. It is not useful for any other formats.

Second. If you want to scale data up to saturation, you should scan for maximum value in image[] field, than scale as you want.
Also, for real image processing you should subtract black value first.

Thank you very much for your help! I did some more "testing" today and set the exposure time to 5 seconds so I would basically get a white picture and calculated the maximum of each channel. This is what I got:

ISO R G B
400 15760 15761 15761
500 15760 15761 15761
640 12810 12811 12811
800 15760 15761 15761
1000 15760 15762 15760
1250 12810 12813 12810
1600 15764 15767 15763

Now at least I know what value I have to normalize with. I still have one technical question: Why are the values for 640 and 1250 different than the others?

bye, Peter

Looks like 640 and 1250 are 'software' ISO on your camera. So 1250 is shot at 1600, than values are divided by 1.25 or so.

It also looks like you've not subtracted black value (about 1000 on your camera).

Comment viewing options

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