Unrawel
Important: Brevity disclaimer.
Intro
Unrawel is the library and simple command-line front-end that were written to experiment with different techniques for digital camera acquired images interpolation and processing.
Areas which are covered include RAW images interpolation, images de-noising and enhancing, white balance determining.
Please note that Unrawel was designed for my own experiments and research rather than a tool for general public - this means its features and interface are not very well suited for people who just need “hit a single button to get results”: you will need to construct the workflow that suits your needs (most likely - including some post-processing outside of Unrawel) in the best way and to deeply understand what different parts of this workflow are.
On the other hand, if you’re interested in ultimate control over how your images are processed - this is exactly the tool you might need.
Please also note that development of Unrawel stopped quite some time ago (main development was done in 2002 - 2003 years), and no support is provided - I’d love to work on it further, but I just have no time for that anymore
Features
Generic program features:
- Support for custom workflow - user specifies in config file a set of operations to apply, there’s no pre-fixed sequences of operations - though, of course, common sense should be used when designing workflow, you hardly want to de-noise RAW image before it is interpolated, for example.
- Support for reading RAW files produced by digital cameras. Currently, only Canon CRW files for several cameras are supported, but it should be trivial to add new formats and cameras.
- Support for ImageMagick can be compiled in to allow reading / writing in different image formats.
- LCMS (little cms engine) is supported to embed color profiles into images and to perform conversions between different profiles.
- Specifying white balance by color temperature & camera profile is supported to get the most accurate results.
- 16 bit, linear processing.
Interpolations algorithms supported:
- Adaptive Color Planes interpolation
- Simple bilinear interpolation
- Corner interpolation
- Adaptive hues interpolation
- Freeman median interpolation
- Multi-gradient interpolation
- Weighted sums interpolation
Some of these algorithms are well-known ones, others were designed as experimental ones by me.
From all my experiments, I especially liked results of “Adaptive hues interpolation” algorithm, which I developed based on ideas of “Adaptive Color Planes interpolation”, but ensuring constancy over hue rather than over brightness, as in “Adaptive Color Planes interpolation”: this idea leads to less color artifacts at the expense of greater brightness variance, which still looks more pleasing to my eye.
Image processing and enhancement algorithms:
- Noise filtering using anisotropic diffusion flow
- Median filtering based on “adaptive direction median”
- Set of simple filters (medians, etc)
- Noise filtering using Total Variation
- Image enhancement using hue correction and diffusion flow
White balance calculation algorithms:
- Dichromatic
- “Grey World”
- “White patch”
Compilation
Sources are provided together with .vcproj files to compile them under Microsoft Visual Studio 2005 - though, they should be perfectly compilable on all VC compilers starting from VC6.0 and on g++ compilers, both for Win32 and for *nixes, this was verified several years ago for Linux and FreeBSD (Probably, for current g++ version you’ll have to adjust some small things, but overal it should be OK). For compilers other than Microsoft VC you’ll have to write makefile or use any other tool for project building, though.
Dependencies are:
- LCMS for color management (required).
- Boost (required), as far as I remember - only header-based libraries are used.
- ImageMagick for working with image formats (optional, but highly advisable).
Examples
Here is one simple example of image processing workflow that is possible with Unrawel, mostly written for beginners.
Image taken by camera (Canon PowerShot S45) and written in RAW format looks like this (all images are magnified 4 times):
The first thing we can do with it is to correct white balance to accommodate lighting source characteristics which was used when the image was taken, and also to take into account camera sensor characteristics.
Here is WB corrected image:
After that, we’re going to interpolate RAW image to guess missing colors:
You can see that converted image has some false-colors at branches, which is unavoidable in one or another form anyway, considering that we’re in fact guessing missing pixels, and chromatic aberrations can also play some effect here.
Now let’s post-process it a bit; we’ll try to remove some of false colors and also remove some noise from the image (not really seen on this fragment, but still very frequent thing for typical images):
As you can see, some of false colors were gone, but overall image sharpness was decreased - this is typical in some form for all noise-reduction algorithms, we’ll add sharpness back later.
Now we’ll apply another form of post-processing based on “diffusion flow” notion: this post-processing also decreases noise and highlights edges in the image. I provide results with parameters that are tuned up considerably so that effect of this step is more evident, you’re unlikely to use such strong parameters on practice.
Finally, there’s time to add sharpness to the image back (done in external software, shown here for process flow completeness only):
For comparison, here’s the result of Canon File Viewer Utility conversion for the same fragment (as Canon utility does not process some pixels at image borders, the sample has less pixels):
As you can see, the result differs not that drastically, only that Canon applies more aggressive sharpening, which results in some artifacts visible, as well as applies some levels adjustment to the original image so that it looks more contrast.
The whole Unrawel script to execute this particular workflow (excluding final sharpening, which was done using “unsharp mask” filter in external program with parameters amount - 100%, radius - 1.0, levels threshold - 1):
Processor::Load()
ImageUtilities::ApplyWBColorTemp(6500,0,S45-linear.icm)
HueGradInterpolator::Interpolate()
TVImageProcessor::ApplyTV()
WeightedEdgeImageProcessor::ApplyDiffusionFlow()
Download
The latest version is 1.03_alpha, here are its sources.