Image Demosaicking with Contour Stencils
|
Bilinear demosaicing. More...
#include "dmbilinear.h"
Go to the source code of this file.
Functions | |
void | CfaFlatten (float *Flat, const float *Input, int Width, int Height, int RedX, int RedY) |
Flatten a CFA-filtered image to a 2D array. More... | |
void | BilinearDifference (float *Output, const float *Diff, int Width, int Height, int RedX, int RedY) |
Bilinearly interpolate (Red - Green) and (Blue - Green) differences. More... | |
void | BilinearDemosaic (float *Output, const float *Input, int Width, int Height, int RedX, int RedY) |
Bilinear demosaicing. More... | |
Bilinear demosaicing.
Copyright (c) 2010-2011, Pascal Getreuer All rights reserved.
This program is free software: you can use, modify and/or redistribute it under the terms of the simplified BSD License. You should have received a copy of this license along this program. If not, see http://www.opensource.org/licenses/bsd-license.html.
Definition in file dmbilinear.c.
void BilinearDemosaic | ( | float * | Output, |
const float * | Input, | ||
int | Width, | ||
int | Height, | ||
int | RedX, | ||
int | RedY | ||
) |
Bilinear demosaicing.
Output | pointer to memory to store the demosaiced image |
Input | the input image as a flattened 2D array |
Width,Height | the image dimensions |
RedX,RedY | the coordinates of the upper-rightmost red pixel |
Bilinear demosaicing is considered to be the simplest demosaicing method and is used as a baseline for comparing more sophisticated methods.
The Input image is a 2D float array of the input RGB values of size Width*Height in row-major order. RedX, RedY are the coordinates of the upper-rightmost red pixel to specify the CFA pattern.
Definition at line 212 of file dmbilinear.c.
void BilinearDifference | ( | float * | Output, |
const float * | Diff, | ||
int | Width, | ||
int | Height, | ||
int | RedX, | ||
int | RedY | ||
) |
Bilinearly interpolate (Red - Green) and (Blue - Green) differences.
Output | output image with the green channel already filled |
Diff | 2D array of (Red - Green) and (Blue - Green) differences |
Width,Height | the image dimensions |
RedX,RedY | the coordinates of the upper-rightmost red pixel |
This routine interpolates (R-G) and (B-G) differences using an already filled green channel. Output should be a contiguous array in row-major planar order where the (second) green channel is filled. The red and blue channels will be filled with the interpolation result. The green channel is unchanged. Diff is a 2D array in row-major order where the values denote (R-G) values at red locations at (B-G) values at blue locations.
To interpolate (B-G) values at a red location, the (B-G) values of its four diagonal neighbors is averaged (the (B-G) values are known here because the the diagonal neighbors are all blue locations). (R-G) values are interpolated at blue locations similarly.
At a green location in a blue row, (B-G) is interpolated by averaging the (B-G) values of its horizontal neighbors, which are both blue locations. (R-G) is interpolated by averaging its vertical neighbors. Interpolation at a green location in a red row is similar.
Definition at line 74 of file dmbilinear.c.
void CfaFlatten | ( | float * | Flat, |
const float * | Input, | ||
int | Width, | ||
int | Height, | ||
int | RedX, | ||
int | RedY | ||
) |
Flatten a CFA-filtered image to a 2D array.
Flat | the output 2D array of size Width by Height |
Input | the input RGB image in row-major planar order |
Width,Height | size of the image |
RedX,RedY | the coordinates of the upper-rightmost red pixel |
Definition at line 26 of file dmbilinear.c.