📄 visionconst.h
字号:
/*
* Copyright (c) 2005-2006,华南理工大学机器人实验室
* All rights reserved.
*
* 文件名称:visionConst.h
* 文件标识:
* 摘 要:常量
*
* 当前版本:1.0
* 作 者:
* 完成日期:
*
* 取代版本:
* 作 者:
* 完成日期:
*/
#ifndef _VISIONCONST_H
#define _VISIONCONST_H
//全向视觉的常量 和 结构体
//const int RADIUS_SIZE= 360;
//const int MAX_RADIUS_LENGTH= 130;
//
//const MAX_SECTOR = 6;
//
//const BYTE _RED=1;
//const BYTE _YELLOW=2;
//const BYTE _BLUE=4;
//const BYTE _GREEN=8;
//const BYTE _WHITE=16;
//const BYTE _BLACKROBOT=32;
//const BYTE _PURPLE=64;
//const BYTE _AZURY=128;
/*************************************************/
//前向视觉的常量 和结构体
struct hsi
{
short h, s, i;
};
struct rgb
{
BYTE r, g, b;
};
//typedef struct hsi image_pixel;
/************************************************/
//baseVision中使用的常量和结构
// 颜色通道数的最大值
#define MAX_COLORS 8
// HSI模型CLASS数组的大小,也就是HSI模形中每一个维对应的"分级"
#define H_COLOR_LEVELS 361
#define S_COLOR_LEVELS 257
#define I_COLOR_LEVELS 256
//RGB模型下面的分级
#define RGB_COLOR_LEVELS 256
//颜色信息
struct color_info
{
rgb color; // example color (such as used in test output)
char *name; // color's meaninful name (e.g. ball, goal)
double merge; // merge density threshold
int expected_num; // expected number of regions (used for merge)
int h_low,h_high; // HSI 颜色模型的各维度参数
int s_low,s_high;
int i_low,i_high;
};
/*********************************************/
//其他
/* 默认的图像 宽度和高度 */
#define DEFAULT_WIDTH 320
#define DEFAULT_HEIGHT 240
#define NONE ((BYTE)(-1))
#ifndef NULL
#define NULL (0)
#endif
#define ZERO(x) memset(x,0,sizeof(x))
#define MIN(a,b) (a<b?a:b)
#define MAX(a,b) (a>b?a:b)
const double PI = 3.1415;
/**
*rgb值转hsi值
*/
inline void RGB2HSI(BYTE r,BYTE g,BYTE b,short *h,short *s,short *i)
{
BYTE max=MAX(r,MAX(g,b));
BYTE min=MIN(r,MIN(g,b));
float delta =(float)(max - min);
float _h = 0;
//calculate i [0 255]
*i = (short)max;
//calculate s [0 256]
*s=(short)(256 * delta / (float)max);
//calculate h [0 360]
if(r == max)
_h = (float)(g-b)/delta;
else if(g == max)
_h = 2 + (float)(b-r)/delta;
else if(b == max)
_h = 4+(r-g)/delta;
*h = (short)( _h * 60.0);
if(*h < 0)
*h +=360;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -