Add new comment

Accessing Raw Bayer data

Hi,

I just downloaded and compiled the libraw APIs. I was trying to use the APIs to access the Raw bayer stream from a canon CR2 file.

After instantiating a LibRaw object and calling its open_file(), unpack() and raw2image() functions, im able to print out pixel values using the imgdata.image[pixelindex][channelindex] data array. (I see a nice RGBG pattern coming out here)

However, if i just instantiate the libraw object, call open_file(), unpack() and then access pixel values from the .imgdata.rawdata.raw_image array, i see only 16384 (the max possible 16bit value) getting dumped out.

After raw2image(), does the imgdata.image array contain raw bayer data or does it undergo any processing? If it is infact the raw bayer, i was hoping to see the same values in the raw_image array (but as a single channel of pixel values) What am i missing here?

Thanks,
HEMANTH

Code snippet :
LibRaw RawProcessor;
RawProcessor.open_file(av[1]));
RawProcessor.unpack();
for(i = 0;i < 100; i++)
{
printf("%d ",(RawProcessor.imgdata.rawdata.raw_image[i]));
}
output : 16384 16384 16384 ....

Forums: