Image data does not match
Hi,
I'm trying to code a very simple raw developing tool. First I want to read and understand the data libraw provides.
But the data I get does not represent the colors in PhotoShop by any means. They are not off by a some digits, they seem to be completely different. The data I get is in the xls and the coresponding first 10x10 pixels from Photoshop. Unfortuantely the cr2 is too big to upload.
What am I missing here or where is the "useable" image data stored?
Thanks and regards from Germany
Rob.
Here's a my code so far:
#include <iostream> #include <fstream> #include "libraw.h" int main() { LibRaw Proc; std::fstream myfile; // Define the parameters for libraw Proc.imgdata.params.shot_select = 0; // Select first RAW, in case there are more Proc.imgdata.params.use_auto_wb = 0; // Auto white-Balance Proc.imgdata.params.use_camera_wb = 1; // Use camera WB instead Proc.imgdata.params.output_color = 1; // [0-6] Output colorspace (0=raw, 1=sRGB, 2=Adobe, 3=Wide, 4=ProPhoto, 5=XYZ, 6=ACES) Proc.imgdata.params.user_qual = 3; // [0-10] Interpolation quality (linear, VNG, PPG, AHD, DCB, DHT, mod. AHD) Proc.imgdata.params.no_auto_bright = 1; // No automatic brightnes Proc.imgdata.params.output_bps = 16; // Output bits Proc.imgdata.params.adjust_maximum_thr = 0.75; // Proc.imgdata.params.aber[0] = 1.0; // Chromatic Abberation Red Proc.imgdata.params.aber[2] = 1.0; // Chromatic Abberation Blue Proc.imgdata.params.bright = 1.0; // Default Proc.imgdata.params.four_color_rgb = 1; // Switches on separate interpolations for two green components. Proc.imgdata.params.highlight = 1; // [0-9] Highlight mode (0=clip, 1=unclip, 2=blend, 3+=rebuild) // Set Gamma switch (Proc.imgdata.params.output_color) { case 1: //sRGB { Proc.imgdata.params.gamm[0] = 1 / 2.4; Proc.imgdata.params.gamm[1] = 12.92; } break; case 4: // ProPhoto { Proc.imgdata.params.gamm[0] = 1 / 1.8; Proc.imgdata.params.gamm[1] = 0.0; } break; default: { Proc.imgdata.params.gamm[0] = 1 / 1.0; Proc.imgdata.params.gamm[1] = 1.0; } } Proc.open_file("C:\\Bild.cr2"); Proc.unpack(); Proc.raw2image(); Proc.dcraw_process(); libraw_processed_image_t* image = Proc.dcraw_make_mem_image(); int rgb_pos = 0; myfile.open("C:\\test.csv"); myfile << ",,,Proc.imgdata.image[pos][],,,,image->data[rgb_pos++],,\n"; myfile << "ID,Row,Col,[R],[G],[B],[G2],[COLOR(r;c)],IMAGE[R],IMAGE[G],IMAGE[B],Raw_image[ID]\n"; for (int r = 0; r < 10 /*Proc.imgdata.sizes.height*/; r++) { for (int c = 0; c < 10 /*Proc.imgdata.sizes.width*/; c++) { unsigned pos = r * Proc.imgdata.sizes.width + c; myfile << pos << "," << r << "," << c << "," << Proc.imgdata.image[pos][0] << "," << Proc.imgdata.image[pos][1] << "," << Proc.imgdata.image[pos][2] << "," << Proc.imgdata.image[pos][3] << "," << Proc.COLOR(r, c) << "," << (int) image->data[rgb_pos++] << "," << (int) image->data[rgb_pos++] << "," << (int) image->data[rgb_pos++] << "," << (int) Proc.imgdata.rawdata.raw_image[pos] << "\n"; } } myfile.close(); std::cout << "Done." << std::endl; getchar(); return EXIT_SUCCESS; }
Attachment | Size |
---|---|
Data from my code | 43 KB |
Recent comments