Add new comment

White Balance

Thanks Alex,

I can now decode images from Canon DSLRs that only show the active area. My test code now looks like this:

m_raw_proc->open_buffer(data, size);
m_raw_proc->unpack();
 
int pos = 0;
int top_margin = m_raw_proc->imgdata.sizes.top_margin;
int left_margin = m_raw_proc->imgdata.sizes.left_margin;
int raw_pitch = m_raw_proc->imgdata.sizes.raw_pitch / 2;
 
for (int r = 0; r < m_raw_proc->imgdata.sizes.height; r++)
{
	for (int c = 0; c < m_raw_proc->imgdata.sizes.width; c++)
	{
		buffer[pos] = m_raw_proc->imgdata.rawdata.raw_image[(r + top_margin) * raw_pitch + left_margin + c];
		pos++;
	}
}

After this code has run, I have undebayered data in buffer[]. This works very well but I have no idea how to apply the in-camera white balance. I would be grateful if you would be able to explain how I apply a white balance or direct me to a resource that explains this. Indeed, is this even possible without using the dcraw functions?

Once again, I thank you for your continued help.

Amanda