Access raw color data

I want to access color data from a raw image in dng format.
I need to compute different statics about color in a certain area of images like mean value and etc.

I tried that consequence of actions:

LibRaw processor;
processor.open_file(path);
processor.unpack();

As I understand I can expect data in processor.imgdata.raw_image and processor.imgdata.raw_image.color3_image after that consequence
But they are empty.
After dcraw_process() and dcraw_make_mem_image(), I receive a picture, but there is something like a purple filter on it. (i expected a green picture from a raw image)

Also, I use a phone which is not supported by the library(Redmi Note 9 Pro)
I am a beginner in image analysis and don't understand a lot(

So, my question is: which consequence is necessary to access unmodified color data. (after de-mosaic for example)
Also, I red advice about using libtiff instead of libraw.

I'm sorry about my question because it is unclear, but I hope that somebody will help me
Best regards, Michael

Forums: 

Depending of file internals

Depending of file internals type (bayer, or full color), only one pointer in imgdata.rawdata is non-NULL:
raw_image - for bayer or X-Trans (color filter array) images
color3_image - for full-color (Foveon, linear DNG) images if 3-channel data extractor was used
color4_image - for full-color images with 4-channel data extractor
(if color4_image is not-NULL, this does not always mean you have 4-channel input, it could-be 3-channeld and zeroes in 4th channel, inspect imgdata.idata.colors for that).

And similar three pointers for floating point input: float_image, float3_image, float4_image.

So, your code should check all six pointers (or only three if floating point input is not expected) and select image type based on 'what pointer is non-NULL'

-- Alex Tutubalin @LibRaw LLC

Question about thumnails?

Thank you very much!
I successfully received pictures from raw_image, but they are small. As I understand I received thumbnails, which raw contains. How I can access the full format picture?
I received such pictures:
https://postimg.cc/gr5k2Kft

I do not know what you're

I do not know what you're doing to convert rawdata into cv:Mat
What I see on screenshot is 3xUINT8 data type. That probably wrong because source (bayer) image contains single component per pixel.

-- Alex Tutubalin @LibRaw LLC