refinery
RAW file processor
|
Transforms a sensor image to an RGB or CMYK image. More...
#include <refinery/interpolate.h>
Public Types | |
enum | Type { INTERPOLATE_AHD, INTERPOLATE_BILINEAR } |
Algorithm, to pass to the constructor. More... | |
Public Member Functions | |
Interpolator (const Type &type) | |
Constructor. | |
RGBImage * | interpolate (const GrayImage &image) |
Produce a colorful image from a gray one. |
Transforms a sensor image to an RGB or CMYK image.
When most cameras capture an image, their sensors only gather one color value per pixel. The other values must be added in software, by the Interpolator.
Crucial in the incoming image is the Image::filters() return value, which describes which colors go where on the camera sensor array.
There are several strategies for guessing the missing color values on each pixel. One, INTERPOLATE_BILINEAR, takes an average from the color values of adjacent pixels. Another, INTERPOLATE_AHD, chooses either vertical or horizontal averages per pixel, depending on which one gives the crispest image.
It's straightforward to interpolate a camera-sensor image:
GrayImage gray = somehowGetGrayImage(); Interpolator interpolator(Interpolator.INTERPOLATE_AHD); RGBImage* rgb = interpolator.interpolate(gray);
Definition at line 35 of file interpolate.h.
Algorithm, to pass to the constructor.
Definition at line 40 of file interpolate.h.
refinery::Interpolator::Interpolator | ( | const Type & | type | ) |
Constructor.
[in] | type | Algorithm this interpolator uses. |
Produce a colorful image from a gray one.
This relies upon GrayImage::filters() to determine what the sensor colors are. This ought to be set automatically from the Exif data, but if the output has cartoony color problems, that might have failed.
It's up to the caller to free the resulting image, with delete
.
[in] | image | Grayscale (from sensor data) image to interpolate. |