libgphoto2 photo camera library (libgphoto2) API
2.5.10.1
|
Adaptive Homogeneity-Directed Bayer array conversion routine. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "config.h"
#include "bayer.h"
#include <gphoto2/gphoto2-result.h>
#include <gphoto2/gphoto2-port-log.h>
Functions | |
int | gp_ahd_interpolate (unsigned char *image, int w, int h, BayerTile tile) |
Interpolate a expanded bayer array into an RGB image. More... | |
int | gp_ahd_decode (unsigned char *input, int w, int h, unsigned char *output, BayerTile tile) |
Convert a bayer raster style image to a RGB raster. More... | |
Adaptive Homogeneity-Directed Bayer array conversion routine.
int gp_ahd_decode | ( | unsigned char * | input, |
int | w, | ||
int | h, | ||
unsigned char * | output, | ||
BayerTile | tile | ||
) |
Convert a bayer raster style image to a RGB raster.
input | the bayer CCD array as linear input |
w | width of the above array |
h | height of the above array |
output | RGB output array (linear, 3 bytes of R,G,B for every pixel) |
tile | how the 2x2 bayer array is layed out |
A regular CCD uses a raster of 2 green, 1 blue and 1 red components to cover a 2x2 pixel area. The camera or the driver then interpolates a 2x2 RGB pixel set out of this data.
This function expands and interpolates the bayer array to 3 times larger bitmap with RGB values interpolated. It does the same job as gp_bayer_decode() but it calls gp_ahd_interpolate() instead of calling gp_bayer_interpolate(). Use this instead of gp_bayer_decode() if you want to use or to test AHD interpolation in a camera library.
References gp_ahd_interpolate(), gp_bayer_expand(), and GP_OK.
int gp_ahd_interpolate | ( | unsigned char * | image, |
int | w, | ||
int | h, | ||
BayerTile | tile | ||
) |
Interpolate a expanded bayer array into an RGB image.
image | the linear RGB array as both input and output |
w | width of the above array |
h | height of the above array |
tile | how the 2x2 bayer array is layed out |
This function interpolates a bayer array which has been pre-expanded by gp_bayer_expand() to an RGB image. It applies the method of adaptive homogeneity-directed demosaicing.
References BAYER_TILE_BGGR, BAYER_TILE_BGGR_INTERLACED, BAYER_TILE_GBRG, BAYER_TILE_GBRG_INTERLACED, BAYER_TILE_GRBG, BAYER_TILE_GRBG_INTERLACED, BAYER_TILE_RGGB, BAYER_TILE_RGGB_INTERLACED, GP_ERROR_NO_MEMORY, and GP_OK.
Referenced by gp_ahd_decode().