Fawkes API  Fawkes Development Version
colorspaces.h
00001 
00002 /***************************************************************************
00003  *  colorspaces.h - This header defines utility functions to deal with
00004  *                  color spaces
00005  *
00006  *  Generated: Tue Feb 23 13:49:38 2005
00007  *  Copyright  2005  Tim Niemueller [www.niemueller.de]
00008  *
00009  ****************************************************************************/
00010 
00011 /*  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version. A runtime exception applies to
00015  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00016  *
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU Library General Public License for more details.
00021  *
00022  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00023  */
00024 
00025 #ifndef __FIREVISION_UTILS_COLOR_COLORSPACES_H_
00026 #define __FIREVISION_UTILS_COLOR_COLORSPACES_H_
00027 
00028 #include <sys/types.h>
00029 
00030 namespace firevision {
00031 #if 0 /* just to make Emacs auto-indent happy */
00032 }
00033 #endif
00034 
00035 /** Color spaces. */
00036 typedef enum {
00037   CS_UNKNOWN            =  0,   /**< Unknown color space */
00038   RGB                   =  1,   /**< RGB, three bytes per pixel, one byte per color, ordered
00039                                  * line by line */
00040   YUV411_PACKED         =  2,   /**< YUV image with 4:1:1 sampling, byte order U Y0 Y1 V Y2 Y3 */
00041   YUV411_PLANAR         =  3,   /**< YUV image with 4:1:1 sampling, first Y plane, then U then V plane */
00042   YUY2                  =  4,   /**< YUV image with 4:2:2 sampling, byte order Y0 U Y1 V */
00043   BGR                   =  5,   /**< RGB, 3 bytes per pixel, one byte per color, ordererd
00044                                  * line by line, pixels orderd B G R */
00045   YUV422_PACKED         =  6,   /**< YUV image with 4:2:2 sampling, byte order U Y0 V Y1 */
00046   YUV422_PLANAR         =  7,   /**< YUV image with 4:2:2 sampling, first Y plane, then U then V plane */
00047   GRAY8                 =  8,   /**< plain gray buffer, one byte per pixel */
00048   RGB_WITH_ALPHA        =  9,   /**< RGB with alpha, 4 bytes per pixel, byte order R G B A */
00049   BGR_WITH_ALPHA        = 10,   /**< RGB with alpha, 4 bytes per pixel, byte order B G R A */
00050   BAYER_MOSAIC_RGGB     = 11,   /**< Image has RGGB bayer pattern */
00051   BAYER_MOSAIC_GBRG     = 12,   /**< Image has GBRG bayer pattern */
00052   BAYER_MOSAIC_GRBG     = 13,   /**< Image has GRBG bayer pattern */
00053   BAYER_MOSAIC_BGGR     = 14,   /**< Image has BGGR bayer pattern */
00054   RAW16                 = 15,   /**< Raw image, 2 bytes per pixel, format depends on camera */
00055   RAW8                  = 16,   /**< Raw image, 1 byte per pixel, format depends on camera */
00056   MONO8                 = 17,   /**< Like GRAY8 */
00057   MONO16                = 18,   /**< Gray-scale image, 2 bytes per pixel */
00058   YUV444_PACKED         = 19,   /**< Full sampled YUV, byte order Y U V */
00059   YVU444_PACKED         = 20,   /**< Full sampled YUV, byte order Y V U */
00060   YVY2                  = 21,   /**< YUV image with 4:2:2 sampling, byte order Y0 V Y1 U */
00061   YUV422_PLANAR_QUARTER = 22,   /**< YUV 422 image in planar format, but only quarter of the image,
00062                                  * used for scale-conversion target, buffer is YUV422_PLANAR formatted. */
00063   CARTESIAN_3D_FLOAT    = 23,   /**< 3D coordinates, one plane for each x, y, and
00064                                  * z (planar), values as float in meters */
00065   CARTESIAN_3D_DOUBLE   = 24,   /**< 3D coordinates, one plane for each x, y, and
00066                                  * z (planar), values as double in meters */
00067   COLORSPACE_N          = 25    /**< number of colorspaces */
00068 } colorspace_t;
00069 
00070 
00071 size_t           colorspace_buffer_size(colorspace_t cspace, unsigned int width, unsigned int height);
00072 colorspace_t     colorspace_by_name(const char *colorspace);
00073 const char *     colorspace_to_string(colorspace_t colorspace);
00074 unsigned char *  malloc_buffer(colorspace_t colorspace, unsigned int width, unsigned int height);
00075 
00076 } // end namespace firevision
00077 
00078 #endif