Add new comment

LibRaw with OpenCV


I use a Canon EOS 1200D.
This camera creates JPEG files with a resolution of 5184 x 3456.
The camera creates also CR2 files.

I use LibRaw to open this file.

LibRaw processor;

If i debug my program i can see:
processor.imgdata.sizes.raw_height = 3516
processor.imgdata.sizes.raw_width = 5344
processor.imgdata.sizes.height = 3465
processor.imgdata.sizes.width = 5202
processor.imgdata.sizes.top_margin = 51
processor.imgdata.sizes.left_margin = 142
processor.imgdata.sizes.iheight = 3465
processor.imgdata.sizes.iwidth = 5202

1/ Why the resolution of 5184 x 3456 does not appeared?

I see also four objects in:
processor.tiff_ifd like this:

[0] {t_width=5184 t_height=3456 bps=8 ...}
[1] {t_width=160 t_height=120 bps=8 ...}
[2] {t_width=668 t_height=432 bps=16 ...}
[3] {t_width=5344 t_height=3516 bps=14 ...}

2/ What does these four objects?

3/ I do not understand what the statement:


Does it convert from RGBG format to RGB format?

Now, i would like create an cv::Mat with the resolution of 5184 x 3456 and without losing accuracy.
4/ So how i can convert my CR2 file to a cv::Mat with format CV_16UC3?

From several CR2 files, i would like create a new image wich is the average.
5/ So, when i have a cv::Mat with format CV_16UC3, how i can save it in a file without losing accuracy?

Thank you.