Greenish again.. why?


I get the code of a dngconverter that uses libraw ->

The only operation that's this conversor does whith raw cells are a mencpy (working with and .CR2 file)

look here -> file librawimage.cpp line 251

memcpy(output, rawProcessor->imgdata.rawdata.raw_image, sizes->raw_height * sizes->raw_width * sizeof(unsigned short));

So if I try divide this raw cells by 2 (or multiply by 0.5) what i get is a dng greenish and darker image (i modify data into output directly at memory before call the function to create dng output file)

Why ?

How can do this simple operation without this greenish colors ?

You can see a dng file converted file without any operation and the same file (but greenish) if you only multiply by 0.5 all his cells here ->

Any idea ? Thanks


To get linear and balanced

To get linear and balanced (not green) data, you need to
1) subtract black level from raw data
2) apply white balance

-- Alex Tutubalin