Recent comments

Reply to: Using only green pixels to create final image (discard red and blue)   11 years 1 month ago

The red and blue filters on most digital cameras are 'wide', so these channels will respond to your (monochrome green) signal.

BTW, if you want to ignore R/B data completely, you may use:

LibRaw lr;
lr.open_file("filename.raw");
lr.unpack();
lr.raw2image();

After these piece of code, your image pixels will reside in lr.imgdata.image[][4] array.
To access pixel value you may use lr.imgdata.image[(row*width)+col][C], where C is color index (R: 0, G: 1, B: 2, Green2: 3).
So, you may interpolate anything you want using only G and G2 channel data.

Use lr.COLOR(row,col) to get color index for given pixel (i.e. which bayer color corresponds to row/col pair)

Reply to: Is out_rgb matrix invertible?   11 years 1 month ago

Alex you got it, I don't get the identity matrix at all!
I then manually inverted the matrix using an online service and saw that pseudoinverse gives a very inaccurate result. If I convert the image using the right values, then the image goes back to rgb properly.
So it is all down to the matrix inversion accuracy..
Thanks for your help!

Reply to: Is out_rgb matrix invertible?   11 years 1 month ago

have you checked that your inverted matrix multiplied to original srgb-to-something matrix produces 'identity matrix' (1s on diagonal and zeroes on all other elements)

Reply to: Gamma correction in Libraw   11 years 1 month ago

Ok, I think it is rather clear now. Thanks.

Reply to: Gamma correction in Libraw   11 years 1 month ago

Please think of this: the scene you are shooting linear. Monitor gamma is applied for inverse companding of the image that has a high gamma. The resulting image on the monitor after inverse companding is close to linear, just as it is in the real world.

Reply to: Gamma correction in Libraw   11 years 1 month ago

BTW, if you want to display/analyze/whatever of RAW data, take look of RawDigger program. http://www.rawdigger.com

Reply to: Gamma correction in Libraw   11 years 1 month ago

The data values in image[] (and raw_image) array are in linear space

The gamma correction applied only on output (dcraw_make_mem_image(), dcraw_ppm_tiff_writer() calls)
convert_to_rgb() only fills the curve[] with gamma_curve() call and rgb maximum calculated on convert-to-rgb stage.

If you need linear output in dcraw_make_mem_image()/ppm_tiff_writer, set output_params.gamm[0] and [1] to 1.0

Reply to: rgb_cam ?   11 years 1 month ago

Thank you Alex, I am going to open another topic about gamma correction....

Reply to: rgb_cam ?   11 years 1 month ago

You're right, these comments are very outdated (from very old dcraw source code).
For now, cmatrix and rgb_cam are used to color conversion too.

Reply to: Issues with cmake and pkg-config   11 years 1 month ago

Cmake files are contributed to LibRaw by our users. If these files are broken, please submit patch using github pull requests system. LibRaw repo is at https://github.com/LibRaw/LibRaw

Reply to: Camera data   11 years 2 months ago

Raw tone curve is applied on LibRaw::unpack() (data extraction).
You may assume that data values are linear after unpack()

Reply to: Camera data   11 years 2 months ago

Ah great!

One more thing I dont quite understand.
I read tone curve from a cr2. This is linear.
I read it from a NEF and it looks quite strange. It grows exponentially from 0 to about 770 and then continues a linear grow. Dos these values also have to undergo a calculation?

Reply to: Camera data   11 years 2 months ago

You need to divide to G1 value (1253).

Reply to: Camera data   11 years 2 months ago

I have one more question.
I read the cam_mul from a cr2.
I got 1987 - 1253 - 2675 - 1253.
From what I read about White Balance Multipliers I was expecting Values in a range of 1.0 - 3.0.
Do I have to devide cam_mul by 1000?

Reply to: Camera data   11 years 2 months ago

For Canon/Nikon cameras, camera profile is static and defined in adobe_coeff() function (in internal/dcraw_common.cpp).
For some cameras (Olympus, Samsung, Phase One), and formats (DNG) camera profile is provided in RAW file (and enabled via params.use_camera_matrix=1)

Reply to: Camera data   11 years 2 months ago

Thanks for the reply,
Is the camera color profile something static per model or is it something variable and an interpreter of the raw file needs?
Sorry, I am just providing a tool for data extraction. My knowledge about digital imaging is pretty limited..

Reply to: Camera data   11 years 2 months ago

cam_mul is camera WB multipliers. From camera.
cam_xyz, pre_mul and rgb_cam are from camera color profile, so from LibRaw.
curve is linear in Canon raws, and from camera for Nikon raws.

Reply to: Do libraw manipulate the colors when loading? possible histogram normalize?   11 years 2 months ago

To get the same result you need to reproduce hidden exposure correction and tone curve from ViewNX.

I know nothing about ViewNX internals, so cannot recommend something meaningful (try LibRaw's exposure correction with highlights compression as in my StackExchange reply)

Reply to: Do libraw manipulate the colors when loading? possible histogram normalize?   11 years 2 months ago

I cant figure out if I am doing something wrong, or if its even possible to get the same result as the output of the nikon viewnx converter tool.

I am happy to provide a raw file and a expected image converted with viewns, if its something really easy for someone good at libraw/dcraw to confirm or deconfirm that its possible.

Reply to: Do libraw manipulate the colors when loading? possible histogram normalize?   11 years 2 months ago

I tried imgD.params.use_camera_wb = 1; and imgD.params.no_auto_bright = 1; which seems to be close. But the image is a bit to dark then. and if using no auto scale, it becomes almost black.

I gave up on just using the raw data without processing because I could not figure out how to make opencv do the demosaic.

Reply to: Do libraw manipulate the colors when loading? possible histogram normalize?   11 years 2 months ago

Depending of what normalization you need, you may use
1) imgdata.params.no_auto_bright=1 to disable auto brighten
2) params.no_auto_scale=1 to disable data scaling to 65536/camera_data_maximum
3) or just use raw data as is from imgdata.rawdata.raw_image (for bayer data) without calls to LibRaw::dcraw_process()

Reply to: Do libraw manipulate the colors when loading? possible histogram normalize?   11 years 2 months ago

If possible can you help me disable these things?

my issue is posted here also:
http://stackoverflow.com/questions/22355491/libraw-is-making-my-images-t...

Reply to: Compile once for i386 and x86_64   11 years 2 months ago

use -arch i386 -arch x86_64 (both flags) in compiler flags when building the library

Reply to: About LibRaw   11 years 2 months ago

DNG is just a TIFF file with custom tags. So, you may modify any tiff-writing code to write DNG.

Reply to: About LibRaw   11 years 2 months ago

I am looking for the simplest possible solution to a simple problem: to compute the average of a number of images stored as dng files, and save it as a dng file. I have not found any ready-made app and have just spent a frustrating afternoon failing to build Adobe's dng sdk. Can you suggest something practical?

Pages