Create 16bit gamma corrected image from raw image
Hi
I'm trying to extract 16bit TIF from raw image ( gamma corrected - not linear ) and only get a very noisy / false-colored image !?
I'm certainly doing something wrong when setting up LibRaw instance...
Any hint appriciated !
Here is my pseudo code ( error handling stripped ) to extract the raw image and create a GraphicsMagick image of the created image data :
LibRaw rawProcessor; rawProcessor.imgdata.params.use_camera_wb = 1; rawProcessor.imgdata.params.output_tiff = 1; rawProcessor.imgdata.params.output_bps = 16; rawProcessor.imgdata.params.output_color = 0; // 0 = raw rawProcessor.imgdata.params.gamm[0] = 1; rawProcessor.imgdata.params.gamm[1] = 1; rawProcessor.imgdata.params.highlight = 0; // 0 = clip rawProcessor.imgdata.params.no_auto_bright = 1; rawProcessor.imgdata.params.user_qual = 3; // 3 = AHD rawProcessor.open_file( inPath ); rawProcessor.unpack(); rawProcessor.dcraw_process(); libraw_processed_image_t *image = rawProcessor.dcraw_make_mem_image(&ret); Magick::Blob blob( image->data, image->data_size ); Magick::Image img( blob, Magick::Geometry(image->width,image->height), rawProcessor.imgdata.params.output_bps, "RGB" ); img.magick("TIF"); // img.gamma( 2.2 ); this does not seem to fix the problem img.write(outPath.toStdString().c_str()); LibRaw::dcraw_clear_mem(image); rawProcessor.recycle();
The following results in proper looking tif image when using settings to extract 8 bit image !?
LibRaw rawProcessor; rawProcessor.imgdata.params.use_camera_wb = 1; rawProcessor.imgdata.params.output_tiff = 1; rawProcessor.imgdata.params.output_bps = 8; rawProcessor.imgdata.params.output_color = 1; // 1 = sRGB rawProcessor.imgdata.params.highlight = 0; // 0 = clip rawProcessor.imgdata.params.no_auto_bright = 1; rawProcessor.imgdata.params.user_qual = 3; // 3 = AHD rawProcessor.open_file( inPath ); rawProcessor.unpack(); rawProcessor.dcraw_process(); libraw_processed_image_t *image = rawProcessor.dcraw_make_mem_image(&ret); Magick::Blob blob( image->data, image->data_size ); Magick::Image img( blob, Magick::Geometry(image->width,image->height), rawProcessor.imgdata.params.output_bps, "RGB" ); img.magick("TIF"); img.write(outPath.toStdString().c_str()); LibRaw::dcraw_clear_mem(image); rawProcessor.recycle();
Recent comments