Flattening dcraw_emu output

Hello, I was looking at the output of dcraw_emu -r 1 1 1 1 -T -6 -o -disinterp of a raw file from bayer pattern sensor. The output consists of 3 channels and the sensor response is divided into each channel. For my purpose, I need to merge all channels into one. What's the proper way to do this?

ps, I tried uncompressed_raw, the data distribution is slightly different from dcraw_emu, and I prefer the result of dcraw_emu.

I have tried summing the image along the channel axis. Something strange happens: the blue channel, which supposed to be:
00000
0B0B0
00000
0B0B0

Has some response at the zero positions, to be specifc, this is a 5x5 patch from the mosaic:
R
[[255 0 255 0 255]
[ 0 0 0 0 0]
[255 0 255 0 255]
[ 0 0 0 0 0]
[255 0 255 0 255]]
G
[[ 0 255 0 255 0]
[255 0 255 0 255]
[ 0 255 0 255 0]
[255 0 255 0 255]
[ 0 255 0 255 0]]
B
[[ 14 0 14 0 14]
[ 0 149 0 149 0]
[ 14 0 14 0 15]
[ 0 146 0 148 0]
[ 14 0 14 0 15]]

Obviously if I sum across the channel axis it will overflow at the R position. What's the response in the blue channel that's supposed to be 0?

Reply is very appreciated.

Forums: 

To get flatten output you may

To get flatten output you may try samples/unprocessed_raw sample

B-channel pattern you show looks ok (one value in 2x2 square), while R-channel is not. Could you please upload raw somewhere and provide the link for in-depth analysis?

-- Alex Tutubalin @LibRaw LLC