I read a raw file and got its Bayer values. If I unpack the RGB values into 3 channels (with half image size) and display it, the result looks very green. I know there is some matrix could be used to convert the raw RGB to sRGB. Can anyone tell me which matrix I should use? I find a RGB2XYZ matrix but not sure how to use it. I do not need any post-processing, and just need the color to be correct.
Thanks in advance!
You need to apply white
You need to apply white balance (usually, before demosaic stage)
-- Alex Tutubalin @LibRaw LLC
from RGB to sRGB is a two
from RGB to sRGB is a two step conversation process, first RGB to XYZ,as you mentioned. But as it is a linear conversation process the conversion matrix (3*3) should be appropriate for the camera model and lighting condition (e.g. D65). from XYZ to sRGB could be another conversation matrix.
Color Management Enthusiastic
Usually a matrix link is
Usually a matrix link is calculated first, to keep things happening in one step.