Fawkes API  Fawkes Development Version
colorspaces.h
1 
2 /***************************************************************************
3  * colorspaces.h - This header defines utility functions to deal with
4  * color spaces
5  *
6  * Generated: Tue Feb 23 13:49:38 2005
7  * Copyright 2005 Tim Niemueller [www.niemueller.de]
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version. A runtime exception applies to
15  * this software (see LICENSE.GPL_WRE file mentioned below for details).
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Library General Public License for more details.
21  *
22  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23  */
24 
25 #ifndef __FIREVISION_UTILS_COLOR_COLORSPACES_H_
26 #define __FIREVISION_UTILS_COLOR_COLORSPACES_H_
27 
28 #include <sys/types.h>
29 
30 namespace firevision {
31 #if 0 /* just to make Emacs auto-indent happy */
32 }
33 #endif
34 
35 /** Color spaces.
36  * Color spaces have their name for historical reasons, but the proper
37  * name would be buffer format. A colorspace defines a particular layout
38  * of a memory buffer containing an image (or point cloud).
39  */
40 typedef enum {
41  CS_UNKNOWN = 0, /**< Unknown color space */
42  RGB = 1, /**< RGB, three bytes per pixel, one byte per color, ordered
43  * line by line */
44  YUV411_PACKED = 2, /**< YUV image with 4:1:1 sampling, byte order U Y0 Y1 V Y2 Y3 */
45  YUV411_PLANAR = 3, /**< YUV image with 4:1:1 sampling, first Y plane, then U then V plane */
46  YUY2 = 4, /**< YUV image with 4:2:2 sampling, byte order Y0 U Y1 V */
47  BGR = 5, /**< RGB, 3 bytes per pixel, one byte per color, ordererd
48  * line by line, pixels orderd B G R */
49  YUV422_PACKED = 6, /**< YUV image with 4:2:2 sampling, byte order U Y0 V Y1 */
50  YUV422_PLANAR = 7, /**< YUV image with 4:2:2 sampling, first Y plane, then U then V plane */
51  GRAY8 = 8, /**< plain gray buffer, one byte per pixel */
52  RGB_WITH_ALPHA = 9, /**< RGB with alpha, 4 bytes per pixel, byte order R G B A */
53  BGR_WITH_ALPHA = 10, /**< RGB with alpha, 4 bytes per pixel, byte order B G R A */
54  BAYER_MOSAIC_RGGB = 11, /**< Image has RGGB bayer pattern */
55  BAYER_MOSAIC_GBRG = 12, /**< Image has GBRG bayer pattern */
56  BAYER_MOSAIC_GRBG = 13, /**< Image has GRBG bayer pattern */
57  BAYER_MOSAIC_BGGR = 14, /**< Image has BGGR bayer pattern */
58  RAW16 = 15, /**< Raw image, 2 bytes per pixel, format depends on camera */
59  RAW8 = 16, /**< Raw image, 1 byte per pixel, format depends on camera */
60  MONO8 = 17, /**< Like GRAY8 */
61  MONO16 = 18, /**< Gray-scale image, 2 bytes per pixel */
62  YUV444_PACKED = 19, /**< Full sampled YUV, byte order Y U V */
63  YVU444_PACKED = 20, /**< Full sampled YUV, byte order Y V U */
64  YVY2 = 21, /**< YUV image with 4:2:2 sampling, byte order Y0 V Y1 U */
65  YUV422_PLANAR_QUARTER = 22, /**< YUV 422 image in planar format, but only quarter of the image,
66  * used for scale-conversion target, buffer is YUV422_PLANAR formatted. */
67  CARTESIAN_3D_FLOAT = 23, /**< 3D coordinates in a packed format. Row major
68  * (x,y,z) tuples, values as float in meters */
69  CARTESIAN_3D_DOUBLE = 24, /**< 3D coordinates in a packed format. Row major
70  * (x,y,z) tuples, values as double in meters */
71  CARTESIAN_3D_FLOAT_RGB = 25, /**< 3D coordinates in a packed format. Row major
72  * (x,y,z, C) tuples, values as float in meters. C is a float
73  * representing the color as RGB data packed as (r,g,b,I) with
74  * r, g, b being one unsigned byte each and I is ignored. */
75 
76  RGB_PLANAR = 26, /**< RGB with three successive planes of R, G, and B each */
77  YUV420_PLANAR = 27, /**< YUV 4:2:0 in planar format */
78  COLORSPACE_N = 28 /**< number of colorspaces */
79 } colorspace_t;
80 
81 
82 size_t colorspace_buffer_size(colorspace_t cspace, unsigned int width, unsigned int height);
83 colorspace_t colorspace_by_name(const char *colorspace);
84 const char * colorspace_to_string(colorspace_t colorspace);
85 unsigned char * malloc_buffer(colorspace_t colorspace, unsigned int width, unsigned int height);
86 
87 } // end namespace firevision
88 
89 #endif