1 /* 2 * CVImageStructs.h 3 * Common image structure definitions used by alternative (non-C++) 4 * interfaces. 5 * 6 * Written by Michael Ellison 7 *------------------------------------------------------------------------- 8 * CodeVis's Free License 9 * www.codevis.com 10 * 11 * Copyright (c) 2004 by Michael Ellison (mike@codevis.com) 12 * All rights reserved. 13 * 14 * You may use this software in source and/or binary form, with or without 15 * modification, for commercial or non-commercial purposes, provided that 16 * you comply with the following conditions: 17 * 18 * * Redistributions of source code must retain the above copyright notice, 19 * this list of conditions and the following disclaimer. 20 * 21 * * Redistributions of modified source must be clearly marked as modified, 22 * and due notice must be placed in the modified source indicating the 23 * type of modification(s) and the name(s) of the person(s) performing 24 * said modification(s). 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 32 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 33 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 34 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 * 38 *--------------------------------------------------------------------------- 39 * Modifications: 40 * 41 *--------------------------------------------------------------------------- 42 *! \file CVImageStructs.h 43 *! \brief Common image structure definitions used by CodeVis 'C' interfaces. 44 *! 45 *! $RCSfile: CVImageStructs.h,v $ 46 *! $Date: 2004/03/01 18:30:31 $ 47 *! $Revision: 1.3 $ 48 *! $Author: mikeellison $ 49 */ 50 #ifndef _CVImageStructs_H_ 51 #define _CVImageStructs_H_ 52 53 #include "CVRes.h" 54 55 #ifndef __cplusplus 56 typedef int CVIMAGETYPE; 57 enum 58 #else 59 enum CVIMAGETYPE 60 #endif 61 { 62 /*! Default type (sometimes used for auto-detect) */ 63 CVIMAGETYPE_DEFAULT = 0, 64 /*! 8-bit red, green, blue triplets */ 65 CVIMAGETYPE_RGB24 = 1, 66 /*! 32-bit float red, green, blue triplets */ 67 CVIMAGETYPE_RGBFLOAT = 2, 68 /*! 8-bit intensity values */ 69 CVIMAGETYPE_GREY = 3, 70 71 72 /* --- currently unimplemented below this line */ 73 CVIMAGETYPE_RGBINT = 4, /*! 32-bit integer red, green, blue triplets */ 74 CVIMAGETYPE_GREYINT = 5, /*! 32-bit integer intensity values */ 75 CVIMAGETYPE_GREYFLOAT = 6, /*! 32-bit floating point intensity values */ 76 }; 77 78 79 const int kCVIMAGESTRUCTVER = 1; 80 81 /* 82 *! CVIMAGESTRUCT holds an image - either RGB24 or 8-bit Greyscale. 83 *! The floating-point RGB images are not currently supported. 84 */ 85 struct CVIMAGESTRUCT 86 { 87 int Version; /*! Structure Version (1) */ 88 CVIMAGETYPE ImageType; /*! Type of image */ 89 int BytesPerPixel; /*! # of bytes per pixel (3) */ 90 int NumChannels; /*! Number of channels (e.g. 3 for RGB, 1 for greyscale) */ 91 int ImageWidth; /*! Width of image in pixels */ 92 int ImageHeight; /*! Height of image in pixels */ 93 int ImageDataSize; /*! Size of image in bytes. Redundant, but quick for checks */ 94 unsigned char* PixelDataPtr; /*! Pointer to raw pixel data (typically r,g,b format) */ 95 }; 96 97 /*! 98 *! These are all the formats in the DirectX 8.1 documentation, 99 *! plus a few I've encountered that weren't in the docs or .h's. 100 *! 101 *! Honestly, we don't particularly care what the format is 102 *! for the DirectX code, but we may need to know on other 103 *! platforms that don't automagically perform conversions. 104 *! 105 *! The library itself currently only returns RGB24, RGBFloat, 106 *! and Grey scale images regardless of the format of the input 107 *! video - totally independant of what format the input video 108 *! is in. 109 *! 110 *! We also need to tell the user what format the camera is 111 *! in to differentiate between the various modes of a camera. 112 *! 113 *! While the type names are ripped from DirectX - these values are not 114 *! equivalent to the DirectX codes. There is a conversion table 115 *! between the two in the DirectX-specific class (CVVidCaptureDSWin32). 116 *! Other platforms will need to convert their own values to these 117 *! as well... 118 */ 119 #ifndef __cplusplus 120 typedef int VIDCAP_FORMAT; 121 enum 122 #else 123 enum VIDCAP_FORMAT 124 #endif 125 { 126 VIDCAP_FORMAT_UNKNOWN = 0, 127 VIDCAP_FORMAT_YVU9, 128 VIDCAP_FORMAT_Y411, 129 VIDCAP_FORMAT_Y41P, 130 VIDCAP_FORMAT_YUY2, 131 VIDCAP_FORMAT_YVYU, 132 VIDCAP_FORMAT_UYVY, 133 VIDCAP_FORMAT_Y211, 134 VIDCAP_FORMAT_CLJR, 135 VIDCAP_FORMAT_IF09, 136 VIDCAP_FORMAT_CPLA, 137 VIDCAP_FORMAT_MJPG, 138 VIDCAP_FORMAT_TVMJ, 139 VIDCAP_FORMAT_WAKE, 140 VIDCAP_FORMAT_CFCC, 141 VIDCAP_FORMAT_IJPG, 142 VIDCAP_FORMAT_Plum, 143 VIDCAP_FORMAT_RGB1, 144 VIDCAP_FORMAT_RGB4, 145 VIDCAP_FORMAT_RGB8, 146 VIDCAP_FORMAT_RGB565, 147 VIDCAP_FORMAT_RGB555, 148 VIDCAP_FORMAT_RGB24, 149 VIDCAP_FORMAT_RGB32, 150 VIDCAP_FORMAT_ARGB32, 151 VIDCAP_FORMAT_Overlay, 152 VIDCAP_FORMAT_QTMovie, 153 VIDCAP_FORMAT_QTRpza, 154 VIDCAP_FORMAT_QTSmc, 155 VIDCAP_FORMAT_QTRle, 156 VIDCAP_FORMAT_QTJpeg, 157 VIDCAP_FORMAT_dvsd, 158 VIDCAP_FORMAT_dvhd, 159 VIDCAP_FORMAT_dvsl, 160 VIDCAP_FORMAT_MPEG1Packet, 161 VIDCAP_FORMAT_MPEG1Payload, 162 VIDCAP_FORMAT_VPVideo, 163 VIDCAP_FORMAT_MPEG1Video, 164 165 /* These weren't defined by DirectX */ 166 VIDCAP_FORMAT_I420, 167 VIDCAP_FORMAT_IYUV, 168 VIDCAP_FORMAT_Y444, 169 VIDCAP_FORMAT_Y800, 170 VIDCAP_FORMAT_Y422, 171 172 /* Number of video capture formats... */ 173 VIDCAP_NUM_FORMATS 174 }; 175 176 177 /* _CVImageStructs_H_ */ 178 #endif 179