Add new comment

Maximum value is not 65535 in the raw image

Hi everyone,

There's something I cannot understand: when extracting the maximum value in the raw image, I obtain a small value whatever the camera used (Nikon D90 or PhaseOne IQ180).
Here is a piece of code to better understand my query:

LibRaw iProcessor;
dimx = iProcessor.imgdata.sizes.width;
dimy = iProcessor.imgdata.sizes.height;
// Reserve memory for image (code not shown)
int width = iProcessor.imgdata.sizes.raw_width;
int yoffset = iProcessor.imgdata.sizes.top_margin;
int xoffset = iProcessor.imgdata.sizes.left_margin;
unsigned short max = 0;
for (int x = 0 ; x < dimx ; ++x) {
	for (int y = 0 ; y < dimy ; ++y) {
		image[i][x][y] = iProcessor.imgdata.rawdata.raw_image[(x+xoffset)+width*(y+yoffset)];
		max = (max > image[i][x][y]) ? max : image[i][x][y];
cout << min << endl;
cout << max << endl;

I obtain something like 3840 with a raw image from D90. I can see on the histogram that it should not be like this!
Can someone give me some clues?