Image Demosaicking with Contour Stencils
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
dmbilinear.c File Reference

Bilinear demosaicing. More...

#include "dmbilinear.h"
Include dependency graph for dmbilinear.c:

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...
 

Detailed Description

Bilinear demosaicing.

Author
Pascal Getreuer getre.nosp@m.uer@.nosp@m.gmail.nosp@m..com

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.

Function Documentation

void BilinearDemosaic ( float *  Output,
const float *  Input,
int  Width,
int  Height,
int  RedX,
int  RedY 
)

Bilinear demosaicing.

Parameters
Outputpointer to memory to store the demosaiced image
Inputthe input image as a flattened 2D array
Width,Heightthe image dimensions
RedX,RedYthe 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.

Here is the caller graph for this function:

void BilinearDifference ( float *  Output,
const float *  Diff,
int  Width,
int  Height,
int  RedX,
int  RedY 
)

Bilinearly interpolate (Red - Green) and (Blue - Green) differences.

Parameters
Outputoutput image with the green channel already filled
Diff2D array of (Red - Green) and (Blue - Green) differences
Width,Heightthe image dimensions
RedX,RedYthe 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.

Parameters
Flatthe output 2D array of size Width by Height
Inputthe input RGB image in row-major planar order
Width,Heightsize of the image
RedX,RedYthe coordinates of the upper-rightmost red pixel

Definition at line 26 of file dmbilinear.c.

Here is the caller graph for this function: