I did download zlib.h and zconf.h added to include files. Or I should build it and add as a dependency? Are there any other external dependencies that I should be aware of? like perhaps libjpeg?
Thanks for the reply.
So I hope, there is actually scope for further optimization.
The problem is, a 2MP raw image is taking more than 2 seconds for processing, which is undesirable considering the requirement. (I am using HummingBoard with iMX6Q uSoM - by solidrun, running ubuntu 12.04 )
'From the box': you may use OpenMP acceleration to speed-up some demosaic methods. Just compile with Openmp (not tested with modern openmp implementations, this code is unchanged for years).
Standard processing do not use intermediate YUV representation, all processing is done in RGB. AHD interpolation uses temporary luminocity map to extrapolate data, but it is possible to use other demosaic methods without such map (e.g. bilinear interpolation or 'half' demosaic). These methods works entirely in RGB.
The only thing LibRaw can do for you is simplify EXIF parsing: you may install your own callback to receive all EXIF tags to catch tag 0x119 (as raw tag dump)
There is no barrel correction code in LibRaw postprocessing.
Unfortunately, lensfun (used bu darktable) doesn't correct the barrel distortion completely,
I have a wide angle shot with my Lumix DMC-FZ1000 where there are still distortions and dark areas near the corners which are not present if the raw file is processed by Silkypix (software distributed with the camera).
Lensfun does not use the embedded lens distortion parameters which are stored in each .rw2 raw file -
see https://syscall.eu/#pana
Which infrastructure of libraw could be used to implement distortion correction based on these data?
1. Canon's RAW visible area is slightly larger than in-camera JPEG
2. Jpeg preview, two smaller previews (to show on camera screen), RAW image.
3. unpack() just unpacks opened file to unprocessed bayer data array. Use dcraw_process to convert to RGB (internally) and dcraw_mem_image() to export 3-channel RGB bitmap.
4-5. know nothing about OpenCV, sorry.
This is ~2 year old comment.
For now, we know *WHY* Nikon does this: this is camera calibration to make white balance coefficients (presets) the same for all cameras (of given model)
So gamma correction is applied after interpolation? Doesn't dcraw (and libraw) use the camera's contrast curves by default? Are contrast curves the same as "tone curves"?
1. To get LibRaw as close as possible to Nikon converter, you need to repeat Nikon converter in most important things: color profile, contrast curves, white balance data, color dithering.
2. output gamma curve (from 16 bit linear to 8-bit gamma) may have holes. Also, in deep shadows some values are missing because of linear sensor nature.
3. You've used no-auto-bright in LibRaw, but no corresponding switch (-W) for dcraw.
Also, if you wish to repeat dcraw as close as possible, set adjust_maximum_thr to 0.f
You need to build it and add as a dependency.
All other dependencies (e.g. libjasper for jpeg2000 files) are optional, including jpeg (you can build libraw without jpeg compression support).
This one is not yet, because 0.18 branch is far from finished
I did download zlib.h and zconf.h added to include files. Or I should build it and add as a dependency? Are there any other external dependencies that I should be aware of? like perhaps libjpeg?
Libraw 0.18 (development branch) needs zlib (zlib.net) to support deflated DNG files.
This it to be changed (this dependency will change to optional) in some future update before 0.18-release.
we will gladly accept optimization patches and/or additional code.
Thanks for the reply.
So I hope, there is actually scope for further optimization.
The problem is, a 2MP raw image is taking more than 2 seconds for processing, which is undesirable considering the requirement. (I am using HummingBoard with iMX6Q uSoM - by solidrun, running ubuntu 12.04 )
'From the box': you may use OpenMP acceleration to speed-up some demosaic methods. Just compile with Openmp (not tested with modern openmp implementations, this code is unchanged for years).
Standard processing do not use intermediate YUV representation, all processing is done in RGB. AHD interpolation uses temporary luminocity map to extrapolate data, but it is possible to use other demosaic methods without such map (e.g. bilinear interpolation or 'half' demosaic). These methods works entirely in RGB.
The only thing LibRaw can do for you is simplify EXIF parsing: you may install your own callback to receive all EXIF tags to catch tag 0x119 (as raw tag dump)
There is no barrel correction code in LibRaw postprocessing.
Unfortunately, lensfun (used bu darktable) doesn't correct the barrel distortion completely,
I have a wide angle shot with my Lumix DMC-FZ1000 where there are still distortions and dark areas near the corners which are not present if the raw file is processed by Silkypix (software distributed with the camera).
Lensfun does not use the embedded lens distortion parameters which are stored in each .rw2 raw file -
see https://syscall.eu/#pana
Which infrastructure of libraw could be used to implement distortion correction based on these data?
Many thanks for a hint,
Helmut
Ok.
Perhaps, there is another solution.
If i do not use the JPEG file from camera but I use the JPEG file converted with LibRaw from the CR2 file.
Now, my 16 bits image will be aligned with the JPEG file.
All my image will have a resolution of 5202 x 3465.
What are the parameters to convert a CR2 file to a JPEG image so that it is similar to a JPEG image of a Canon camera?
Sorry, LibRaw does not provide any data to perform this alignment (yet).
I really need to get a picture that is aligned on the JPEG picture.
In the private object:
i can see the good resolution but not the margin.
1. Canon's RAW visible area is slightly larger than in-camera JPEG
2. Jpeg preview, two smaller previews (to show on camera screen), RAW image.
3. unpack() just unpacks opened file to unprocessed bayer data array. Use dcraw_process to convert to RGB (internally) and dcraw_mem_image() to export 3-channel RGB bitmap.
4-5. know nothing about OpenCV, sorry.
In-camera crops are specific to camera (and camera crop mode). LibRaw does not read this data.
Use full image instead.
Thank you for your quick answer.
Ok, so I have to use:
But how i can specify to use the JPEG resolution?
I think it is with:
but how specify the JPEG resolution without hard coding?
This is ~2 year old comment.
For now, we know *WHY* Nikon does this: this is camera calibration to make white balance coefficients (presets) the same for all cameras (of given model)
Yes, gamma correction is applied on output. Internal Libraw/dcraw storage is linear, no tone curve applied.
Also found this: http://www.libraw.org/comment/3287#comment-3287
So gamma correction is applied after interpolation? Doesn't dcraw (and libraw) use the camera's contrast curves by default? Are contrast curves the same as "tone curves"?
1. To get LibRaw as close as possible to Nikon converter, you need to repeat Nikon converter in most important things: color profile, contrast curves, white balance data, color dithering.
2. output gamma curve (from 16 bit linear to 8-bit gamma) may have holes. Also, in deep shadows some values are missing because of linear sensor nature.
3. You've used no-auto-bright in LibRaw, but no corresponding switch (-W) for dcraw.
Also, if you wish to repeat dcraw as close as possible, set adjust_maximum_thr to 0.f
Image fixed (you need to check []Display checkbox to display).
LibRaw's and dcraw's images (with same parameters) should be very close (or identical).
For unknown reason you use no_auto_bright for LibRaw and auto-brightening (default) for dcraw. That's why dcraw's histogram is shifted to the right.
I do not see any attached image.
Bayer image contains only one color component per pixel.
image[][4] array has 4 components per pixel (R,G,B,G2 or CMYG or RGBE).
raw2image() copies bayer data into image array
What do you mean for one component out of 4? I actually noticed this, but I don't really understand what's going on.
For testing (it uses extra memory, so not mobile friendly):
should work.
And replace with your own LibRaw_datastream implementation later.
Pages