#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "libAuxiliary.h"
Go to the source code of this file.
Functions | |
void | demosaicking_adams (float threshold, int redx, int redy, float *ired, float *igreen, float *iblue, float *ored, float *ogreen, float *oblue, int width, int height) |
Classical Adams-Hamilton demosaicking algorithm. | |
void | demosaicking_bilinear_red_blue (int redx, int redy, float *ored, float *ogreen, float *oblue, int width, int height) |
Classical bilinear interpolation of red and blue differences with the green channel. | |
void | demosaicking_nlmeans (int bloc, float h, int redx, int redy, float *ired, float *igreen, float *iblue, float *ored, float *ogreen, float *oblue, int width, int height) |
NLmeans based demosaicking. | |
void | chromatic_median (int iter, int redx, int redy, int projflag, float side, float *ired, float *igreen, float *iblue, float *ored, float *ogreen, float *oblue, int width, int height) |
Iterate median filter on chromatic components of the image. | |
void | ssd_demosaicking_chain (int redx, int redy, float *ired, float *igreen, float *iblue, float *ored, float *ogreen, float *oblue, int width, int height) |
Demosaicking chain. |
void chromatic_median | ( | int | iter, | |
int | redx, | |||
int | redy, | |||
int | projflag, | |||
float | side, | |||
float * | ired, | |||
float * | igreen, | |||
float * | iblue, | |||
float * | ored, | |||
float * | ogreen, | |||
float * | oblue, | |||
int | width, | |||
int | height | |||
) |
Iterate median filter on chromatic components of the image.
[in] | ired,igreen,iblue | initial image |
[in] | iter | number of iteracions |
[out] | ored,ogreen,oblue | filtered output |
[in] | (redx,redy) | coordinates of the red pixel: (0,0), (0,1), (1,0), (1,1) |
[in] | side | median in a (2*side+1) x (2*side+1) window |
[in] | projflag | if not zero, values of the original CFA are kept |
[in] | width,height | size of the image |
Definition at line 482 of file libdemosaicking.cpp.
void demosaicking_adams | ( | float | threshold, | |
int | redx, | |||
int | redy, | |||
float * | ired, | |||
float * | igreen, | |||
float * | iblue, | |||
float * | ored, | |||
float * | ogreen, | |||
float * | oblue, | |||
int | width, | |||
int | height | |||
) |
Classical Adams-Hamilton demosaicking algorithm.
The green channel is interpolated directionally depending on the green first and red and blue second directional derivatives. The red and blue differences with the green channel are interpolated bilinearly.
[in] | ired,igreen,iblue | original cfa image |
[out] | ored,ogreen,oblue | demosaicked output |
[in] | (redx,redy) | coordinates of the red pixel: (0,0), (0,1), (1,0), (1,1) |
[in] | threshold | value to consider horizontal and vertical variations equivalent and average both estimates |
[in] | width,height | size of the image |
Definition at line 84 of file libdemosaicking.cpp.
void demosaicking_bilinear_red_blue | ( | int | redx, | |
int | redy, | |||
float * | ored, | |||
float * | ogreen, | |||
float * | oblue, | |||
int | width, | |||
int | height | |||
) |
Classical bilinear interpolation of red and blue differences with the green channel.
[in] | ored,ogreen,oblue | original cfa image with green interpolated |
[out] | ored,ogreen,oblue | demosaicked output |
[in] | (redx,redy) | coordinates of the red pixel: (0,0), (0,1), (1,0), (1,1) |
[in] | width,height | size of the image |
Definition at line 210 of file libdemosaicking.cpp.
void demosaicking_nlmeans | ( | int | bloc, | |
float | h, | |||
int | redx, | |||
int | redy, | |||
float * | ired, | |||
float * | igreen, | |||
float * | iblue, | |||
float * | ored, | |||
float * | ogreen, | |||
float * | oblue, | |||
int | width, | |||
int | height | |||
) |
NLmeans based demosaicking.
For each value to be filled, a weigthed average of original CFA values of the same channel is performed. The weight depends on the difference of a 3x3 color patch
[in] | ired,igreen,iblue | initial demosaicked image |
[out] | ored,ogreen,oblue | demosaicked output |
[in] | (redx,redy) | coordinates of the red pixel: (0,0), (0,1), (1,0), (1,1) |
[in] | bloc | research block of size (2+bloc+1) x (2*bloc+1) |
[in] | h | kernel bandwidth |
[in] | width,height | size of the image |
Definition at line 330 of file libdemosaicking.cpp.
void ssd_demosaicking_chain | ( | int | redx, | |
int | redy, | |||
float * | ired, | |||
float * | igreen, | |||
float * | iblue, | |||
float * | ored, | |||
float * | ogreen, | |||
float * | oblue, | |||
int | width, | |||
int | height | |||
) |
Demosaicking chain.
Compute initialization by Adams-Hamilton algorithm (u0)
for h in {16,4,1} do {
u <- NL_h(u0); Apply NLmeans demosaicking
u <- CR(u); Apply chromatic regularization
u0 <- u;
}
Output <- u;
[in] | ired,igreen,iblue | initial image |
[out] | ored,ogreen,oblue | filtered output |
[in] | (redx,redy) | coordinates of the red pixel: (0,0), (0,1), (1,0), (1,1) |
[in] | width,height | size of the image |
Definition at line 586 of file libdemosaicking.cpp.