Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
cmv_types.hGo to the documentation of this file.00001 /*======================================================================== 00002 cmv_types.h : Base types for CMVision2 00003 ------------------------------------------------------------------------ 00004 Copyright (C) 1999-2002 James R. Bruce 00005 School of Computer Science, Carnegie Mellon University 00006 ------------------------------------------------------------------------ 00007 This software is distributed under the GNU General Public License, 00008 version 2. If you do not have a copy of this licence, visit 00009 www.gnu.org, or write: Free Software Foundation, 59 Temple Place, 00010 Suite 330 Boston, MA 02111-1307 USA. This program is distributed 00011 in the hope that it will be useful, but WITHOUT ANY WARRANTY, 00012 including MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00013 ========================================================================*/ 00014 00015 #ifndef __CMVISION_TYPES_H__ 00016 #define __CMVISION_TYPES_H__ 00017 00018 #include "colors.h" 00019 00020 namespace CMVision{ 00021 00022 typedef unsigned char uchar; 00023 00024 // uncomment if your compiler supports the "restrict" keyword 00025 // #define restrict __restrict__ 00026 #define restrict 00027 00028 template <class pixel> 00029 class image{ 00030 public: 00031 pixel *buf; 00032 int width,height,row_stride; 00033 }; 00034 00035 template <class pixel> 00036 class image_idx{ 00037 public: 00038 pixel *buf; 00039 int width,height,row_stride; 00040 }; 00041 00042 template <class element> 00043 class image_yuv { 00044 public: 00045 element *buf_y,*buf_u,*buf_v; 00046 int width,height; 00047 int row_stride; // number of elements to skip to move one row in buf_[yuv] (handle row interleaving) 00048 int col_stride; // number of elements to move one column in buf_[yuv] (handle pixel interleaving) 00049 }; 00050 00051 #define CMV_PARAM <class pixel,class vimage,class threshold> 00052 #define CMV_TEM template CMV_PARAM 00053 00054 #define CMV_NONE ((unsigned)(-1)) 00055 00056 /* 00057 // Options for level of processing 00058 // use enable()/disable() to change 00059 #define CMV_THRESHOLD 0x01 00060 #define CMV_COLOR_AVERAGES 0x02 00061 #define CMV_DUAL_THRESHOLD 0x04 00062 #define CMV_DENSITY_MERGE 0x08 00063 00064 #define CMV_VALID_OPTIONS 0x0F 00065 */ 00066 00067 template <class cclass> 00068 class run{ 00069 public: 00070 short x,y,width; // location and width of run 00071 cclass color; // which color(s) this run represents 00072 int parent,next; // parent run and next run in run list 00073 }; 00074 00075 template <class cclass> 00076 class run_mini{ 00077 public: 00078 short x,y,width; // location and width of run 00079 cclass color; // which color(s) this run represents 00080 short parent,next; // parent run and next run in run list 00081 }; 00082 00083 struct region{ 00084 int color; // id of the color 00085 int x1,y1,x2,y2; // bounding box (x1,y1) - (x2,y2) 00086 float cen_x,cen_y; // centroid 00087 int area; // occupied area in pixels 00088 int run_start; // first run index for this region 00089 int iterator_id; // id to prevent duplicate hits by an iterator 00090 region *next; // next region in list 00091 }; 00092 00093 struct region_small{ 00094 short color; // id of the color 00095 short x1,y1,x2,y2; // bounding box (x1,y1) - (x2,y2) 00096 short iterator_id; // id to prevent duplicate hits by an iterator 00097 float cen_x,cen_y; // centroid 00098 int area; // occupied area in pixels 00099 int run_start; // first run index for this region 00100 region *next; // next region in list 00101 }; 00102 00103 struct region_tiny{ 00104 uchar color; // id of the color 00105 uchar x1,y1,x2,y2; // bounding box (x1,y1) - (x2,y2) 00106 float cen_x,cen_y; // centroid 00107 short area; // occupied area in pixels 00108 short run_start; // first run index for this region 00109 short iterator_id; // id to prevent duplicate hits by an iterator 00110 region *next; // next region in list 00111 }; 00112 00113 struct color_class_state{ 00114 color_class_state() : list(), num(), min_area(), total_area(), merge_threshold(), color(), name() {} 00115 color_class_state(const color_class_state& c) : list(c.list), num(c.num), min_area(c.min_area), total_area(c.total_area), merge_threshold(c.merge_threshold), color(c.color), name(c.name) {} 00116 color_class_state& operator=(const color_class_state& c) { list=c.list; num=c.num; min_area=c.min_area; total_area=c.total_area; merge_threshold=c.merge_threshold; color=c.color; name=c.name; return *this;} 00117 region *list; // head of region list for this color 00118 int num; // number of regions of this color 00119 int min_area; // minimum area for a meaningful region 00120 int total_area; // total area covered by color 00121 float merge_threshold; // minimum density of merged region 00122 rgb color; // example color (such as used in test output) 00123 char *name; // color's meaningful name (e.g. orange ball, goal) 00124 }; 00125 00126 } // namespace 00127 00128 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:46 2005 by Doxygen 1.4.4 |