Hi there,
Just wondering if I set "output_color" to 0, does "libraw" generate "Camera RAW" RGB data? if so, since it does not apply the color profile, do I need to set other parameters such as "use_camera_wb" or "no_auto_bright"?
Thanks so very much!
If you want to get
If you want to get unprocessed RAW values, it is better to use:
- either imgdata.rawdata.raw_image array (complete unprocessed data)
- or use raw2image() call and use imgdata.image[] array (for bayer images, only one component of 4 will be non-zero)
output_color=0 does not disables white balance and auto-bright
-- Alex Tutubalin @LibRaw LLC
CameraRAW RGB
Thanks for the quick reply!
With the following setting:
OUT.use_camera_matrix = 0;
OUT.output_color = 0;
OUT.highlight = 0;
OUT.use_camera_wb = 0;
OUT.gamm[0] = 1.0;
OUT.gamm[1] = 1.0;
OUT.no_auto_bright = 1;
Will I get a demosaic raw without any post-processing?
You'll get white balance
You'll get white balance (daylight, because of use_camera_wb=0), demosaic and output range scaling.
-- Alex Tutubalin @LibRaw LLC
output_color = 0 and half_size
Hi,
Thanks for the quick response!
I tried to use "output_color = 0" and "half_size = 1" at the same time, the output looks like a channel is missing.
Is there a way that I can have a unprocessed raw in half size? Perhaps I am unaware of something?
Thanks a lot,
To get fully unprocessed raw
To get fully unprocessed raw data you may
1) Access imgdata.rawimage.raw_data array which stores raw values read from sensor as is
2) set params.half_size=1 and call raw2image() after unpack (instead of dcraw_process).
raw2image will arrange raw_data to imgdata.image[][4] array
-- Alex Tutubalin @LibRaw LLC
demosaic raw
Thanks a lot for the quick reply!
I meant the "raw image data" that only has demosaic process. In this case, I may still need "dcraw_process", right? if it is, then when I use "output_color = 0" and "half_size = 1", the output seems like missing a channel.
Have a great day!
I did not understand exactly
I did not understand exactly what you want
Standard raw processing sequence is (for decoded/linearized data) in dcraw_process is
- black subtraction
- white balance
- demosaic
- data scaling to use full range
- conversion to output color space
Than, on output
- brightness correction
- gamma curve
What stages do you need and what is not?
BTW, besides demosaic, all other steps are trivial and very easy to implement.
-- Alex Tutubalin @LibRaw LLC
More details on my question :)
Hi Alex,
Thank you for the quick reply! Appreciate it!
I understand there are several steps if dcraw_process () is called. Since I am interested in getting the image data that is very close to the "demosaic RAW", I manually set some parameter to "avoid" unnecessary processing on the RGB code values. For example, I did the following:
-----------------------------------------
use_camera_matrix = 0;
highlight = 0;
use_camera_wb = 0;
output_color = 0;
gamm[0] = 1.0; gamm[1] = 1.0;
no_auto_bright = 1;
user_mul[0] = 1.0; user_mul[1] = 1.0; user_mul[2] = 1.0;
-----------------------------------------
If the setting sounds reasonable, when I add "half_size=1", the converted image looks like a channel is missing.
Thanks a lot!
I can not understand what
I can not understand what 'demosaic RAW' is.
If you just need 'source' (unaltered) values from sensor/raw file, it is much better to access imgdata.rawdata.raw_image directly.
dcraw_process() means multiple processing stages. Your parameters looks like you need unaltered image.
-- Alex Tutubalin @LibRaw LLC
unaltered image
Hi Alex,
"Unaltered image" is something close to what I am interested. Given the parameters that I enlisted, do they look reasonable to get the "Unaltered image"?
Also, only if you have time, would you mind replicating my test by adding "half_size = 1" (see below) and see if the converted image looks correct?
-----------------------------------------
use_camera_matrix = 0;
highlight = 0;
use_camera_wb = 0;
output_color = 0;
gamm[0] = 1.0; gamm[1] = 1.0;
no_auto_bright = 1;
user_mul[0] = 1.0; user_mul[1] = 1.0; user_mul[2] = 1.0;
half_size = 1;
-----------------------------------------
Thanks a lot!
What is 'converted image'?
What is 'converted image'? imgdata.image array, or result of dcraw_mem_image() call?
-- Alex Tutubalin @LibRaw LLC
I'm still cannot understand
I'm still cannot understand what kind of data you need. You wrote 'close to', but could you please describe what you really need?
-- Alex Tutubalin @LibRaw LLC
image data only after demosaic
Hi Alex,
I would like to use the RAW data without calling "dcraw_mem_image()"; however, there is still a need for demosaic. Currently, I have to use "dcraw_mem_image()" with the parameters listed before to get it as close as possible.
If there is a function that I can call to get the image data that only goes through demosaic step (with no other adjustment), that would be great!
Thanks,
Normal demosaic (not 'half'
Normal demosaic (not 'half' or 'linear interpolation') is useless without white balance first.
-- Alex Tutubalin @LibRaw LLC
Hi Alex,
Hi Alex,
From what you said, it seems like the "white balance" is necessary before normal demosaic. If a user want to supply her/his own white balance factors, it can still be done through "user_mul[i]", correct?
Also, when I use "output_color = 0" and "half_size = 1" together (regardless other parameter), the image seems to look strange. Can you take a look at it?
Thanks so much and have a nice day!
Yes, you can set custom WB
Yes, you can set custom WB via user_mul. But for wrong WB demosaic results may be not good as expected.
dcraw_emu -o 0 -h works for me
(-o 0 translates to output_color=0, -h translates to half_size-1)
-- Alex Tutubalin @LibRaw LLC
Linearization
Hi Alex,
Just wondering where the "Linearization" stands during "raw processing"?
Thanks a lot,
Mio
White balance is, in most
White balance is, in most cases, applied to linear data, so linearization is done before white balance. Traditional approach to demosaicking is also to apply it to linear data, so linearization quite often precedes demosaicking. That makes linearization the first step of raw processing.
--
Iliah Borg
Linear space in Raw?
Thanks a lot!
Just wondering if some camera actually record raw data in linear space? If that is true, can “libraw” tell us if the raw data is already in linear space?
LibRaw applies (some)
LibRaw applies (some) linearization data on unpack() phase.
-- Alex Tutubalin @LibRaw LLC
meta data and linear?
Thanks, Alex!
If the camera records raw in linear space, there must be a way to know it during "unpack()" stage, correct? is it indicated somewhere in the meta data of the RAW file?
There are a lot of different
There are a lot of different RAW formats (data formats, metadata formats, metadata values), it's pretty hard to discuss them all at once.
In general, you may assume that unpack() provides linear data/black level not subtracted.
-- Alex Tutubalin @LibRaw LLC