bayer.c File Reference

Bayer array conversion routines. More...

#include "config.h"
#include "bayer.h"
#include <gphoto2/gphoto2-result.h>

Include dependency graph for bayer.c:


Defines

#define RED   0
#define GREEN   1
#define BLUE   2
#define AD(x, y, w)   ((y)*(w)*3+3*(x))

Functions

int gp_bayer_expand (unsigned char *input, int w, int h, unsigned char *output, BayerTile tile)
 Expand a bayer raster style image to a RGB raster.
int gp_bayer_interpolate (unsigned char *image, int w, int h, BayerTile tile)
 Interpolate a expanded bayer array into an RGB image.
int gp_bayer_decode (unsigned char *input, int w, int h, unsigned char *output, BayerTile tile)
 Convert a bayer raster style image to a RGB raster.

Detailed Description

Bayer array conversion routines.

Author:
Copyright 2001 Lutz Müller <lutz@users.sf.net>

Copyright 2007 Theodore Kilgore <kilgota@auburn.edu>

gp_bayer_accrue() from Theodore Kilgore <kilgota@auburn.edu> contains suggestions by B. R. Harris (e-mail address disappeared) and Werner Eugster <eugster@giub.unibe.ch>
License
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Function Documentation

int gp_bayer_decode ( unsigned char *  input,
int  w,
int  h,
unsigned char *  output,
BayerTile  tile 
)

Convert a bayer raster style image to a RGB raster.

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

Returns:
a gphoto error code

int gp_bayer_expand ( unsigned char *  input,
int  w,
int  h,
unsigned char *  output,
BayerTile  tile 
)

Expand a bayer raster style image to a RGB raster.

Parameters:
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 the bayer array to 3 times larger bitmap with RGB values copied as-is. Pixels were no sensor was there are 0. The data is supposed to be processed further by for instance gp_bayer_interpolate().

Returns:
a gphoto error code

int gp_bayer_interpolate ( unsigned char *  image,
int  w,
int  h,
BayerTile  tile 
)

Interpolate a expanded bayer array into an RGB image.

Parameters:
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 uses various interpolation methods, also see gp_bayer_accrue().

Returns:
a gphoto error code


Generated on Sun Jul 22 19:29:35 2007 for libgphoto2 photo camera library (libgphoto2) by  doxygen 1.5.0