26 #ifndef __CMVISION_H__ 27 #define __CMVISION_H__ 67 #define CMV_COLOR_LEVELS 256 68 #define CMV_MAX_COLORS 32 71 #define CMV_DEFAULT_WIDTH 320 72 #define CMV_DEFAULT_HEIGHT 240 75 #define CMV_MAX_RUNS (CMV_DEFAULT_WIDTH * CMV_DEFAULT_HEIGHT) / 4 76 #define CMV_MAX_REGIONS CMV_MAX_RUNS / 4 77 #define CMV_MIN_AREA 20 79 #define CMV_NONE ((unsigned)(-1)) 90 unsigned char y1,u,y2,v;
94 unsigned char u,y1,v,y2;
98 typedef struct uyvy image_pixel;
100 typedef struct yuv422 image_pixel;
106 unsigned char red,green,blue;
112 #define CMV_THRESHOLD 0x01 113 #define CMV_COLOR_AVERAGES 0x02 114 #define CMV_DUAL_THRESHOLD 0x04 115 #define CMV_DENSITY_MERGE 0x08 117 #define CMV_VALID_OPTIONS 0x0F 129 int sum_x,sum_y,sum_z;
166 unsigned y_class[CMV_COLOR_LEVELS];
167 unsigned u_class[CMV_COLOR_LEVELS];
168 unsigned v_class[CMV_COLOR_LEVELS];
170 region region_table[CMV_MAX_REGIONS];
171 region *region_list[CMV_MAX_COLORS];
172 int region_count[CMV_MAX_COLORS];
174 rle rmap[CMV_MAX_RUNS];
187 void classifyFrame(image_pixel * restrict img,
unsigned * restrict map);
188 int encodeRuns(
rle * restrict out,
unsigned * restrict map);
189 void connectComponents(
rle * restrict map,
int num);
190 int extractRegions(
region * restrict reg,
rle * restrict rmap,
int num);
191 void calcAverageColors(
region * restrict reg,
int num_reg,
192 image_pixel * restrict img,
193 rle * restrict rmap,
int num_runs);
194 int separateRegions(
region * restrict reg,
int num);
195 region *sortRegionListByArea(
region * restrict list,
int passes);
196 void sortRegions(
int max_area);
199 int mergeRegions(
region *p,
int num,
double density_thresh);
208 bool initialize(
int nwidth,
int nheight);
209 bool loadOptions(
char *filename);
210 bool saveOptions(
char *filename);
211 bool enable(
unsigned opt);
212 bool disable(
unsigned opt);
215 bool testClassify(
rgb * restrict out,image_pixel * restrict
image);
216 bool getThreshold(
int color,
217 int &y_low,
int &y_high,
218 int &u_low,
int &u_high,
219 int &v_low,
int &v_high);
220 bool setThreshold(
int color,
221 int y_low,
int y_high,
222 int u_low,
int u_high,
223 int v_low,
int v_high);
228 char *getColorName(
int color)
229 {
return(colors[color].name);}
230 rgb getColorVisual(
int color)
231 {
return(colors[color].color);}
234 {
return(&colors[color]);}
236 {info = colors[color];}
238 {colors[color] = info;}
240 bool processFrame(image_pixel *image);
241 bool processFrame(
unsigned *map);
242 int numRegions(
int color_id);
243 region *getRegions(
int color_id);
244 void set_cmv_min_area(
int area) { cmv_min_area = area; }
245 void set_cmv_max_area(
int area) { cmv_max_area = area; }
Definition: cmvision.h:161
Definition: cmvision.h:85
Definition: cmvision.h:122
Definition: cmvision.h:143
Definition: cmvision.h:120
Definition: cmvision.h:153
Definition: cmvision.h:157
Definition: cmvision.h:137
Definition: cmvision.h:89
Definition: cmvision.h:93
Definition: cmvision.h:105