I have taken the follow code from this question and I am trYing to visualize the colors of an bmp image.
int row_padded = (width*3 + 3) & (~3);
char* data = new char[row_padded];
char tmp;
for(int i = 0; i < height; i++) {
fread(data, sizeof( char), row_padded, f);
for(int j = 0; j < width*3; j += 3) {
cout << "B: "<< (double)data[j] << " G: " << (double)data[j+1]<< " R: " << (double)data[j+2]<< endl;
}
}
This is the image:
However most of the results I get are B:0 G:0 R:0, despite the fact the picture has nothing black on it.
Is this the right way to get the colors?