⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 un_autocameracontrol.h

📁 用于DSP下摄像机的图像抓取、图像处理和传输、以及与上位机TCP/IP通信的工程文件。基于Texas Instruments Code Composer Studio实现。
💻 H
字号:
/******************************************************************************
COPYRIGHTS (C), 2008, UNIC Technologies, Inc.

FILE NAME:		UN_AutoCameraControl.h
AUTHOR:			Steve Tang
COMMENTS:		auto camera control
HISTORY:		11-29-2008, v0.5, first version
				12-01-2008, v0.6, added single step AGC, AEC functions
*******************************************************************************/

#ifndef _UN_AUTO_CAMERA_CONTROL_H
#define _UN_AUTO_CAMERA_CONTROL_H

/************************************************************************/
/* parameter structure for automatic camera control (AGC/AEC)           */
/************************************************************************/
typedef struct UAGE_param_tag {
	int		nMinGain;		/*min gain*/
	int		nMaxGain;		/*max gain*/
	int		nMinExposure;	/*min exposure time (>0)*/
	int		nMaxExposure;	/*max exposure time*/
	int		nTargetBrightness;	/*target average brightness*/
	int		nBrightnessTh;		/*target brightness threshold*/

	int		nGainStep; /*gain step (>=1 && <(nMaxGain-nMinGain))*/
	int		nExposureStep; /*exposure time step (>=1 && <(nMaxExposure-nMinExposure))*/


	/*int		nCtrlType; //see UAGE_CONTROL_TYPE*/
	/*int		nAdjustMethod; //see UAGE_SPEED_MODE*/

	/*reserved fields for extension*/
	int		nReserved1;
	int		nReserved2;
	int		nReserved3;
	int		nReserved4;
	float	fReserved5;
	float	fReserved6;
	float	fReserved7;
	float	fReserved8;
} UAGE_PARAM;

enum UAGE_CONTROL_TYPE
{
	UAGE_CONTROL_TYPE_AEC_AGC = 0, /*combined AEC and AGC*/
	UAGE_CONTROL_TYPE_AEC, /*AEC*/
	UAGE_CONTROL_TYPE_AGC, /*AGC*/
	UAGE_CONTROL_TYPE_TOTAL
};

enum UAGE_ADJUST_METHOD
{
	UAGE_ADJUST_METHOD_GRADUAL = 0,
	UAGE_ADJUST_METHOD_GREEDY,
	UAGE_SPEED_MODE_TOTAL
};

/************************************************************************/
/* color mode of image buffer                                           */
/************************************************************************/
enum UAGE_COLOR_MODE
{
	UAGE_COLOR_MODE_GRAY = 0,
	UAGE_COLOR_MODE_RGB,
	UAGE_COLOR_MODE_BAYER_GBGR,
	UAGE_COLOR_MODE_BAYER_GRGB,
	UAGE_COLOR_MODE_BAYER_RGBG,
	UAGE_COLOR_MODE_BAYER_BGRG,
	UAGE_COLOR_MODE_YUYV,
	UAGE_COLOR_MODE_TOTAL
};

/************************************************************************/
/*	Multiple steps AEC and AGC											*/
/*	Note: (1) three mode provided: AGC; AEC; combined AGC and AEC		*/
/*		  (2) in camera continuous mode, using small steps (e.g.		*/
/*            nGainStep=1, nExposureStep=1)								*/
/*        (3) in camera trigger mode, using larger steps to speed up	*/
/*            convergence												*/
/************************************************************************/
/*automatic gain control (AGC)*/
void UAGE_AutoGain(UAGE_PARAM &stParam, int nBrightness, unsigned int &nGain);

/*automatic exposure control (AEC)*/
void UAGE_AutoExposure(UAGE_PARAM &stParam, int nBrightness, unsigned int &nExposure);

/*combined AEC and AGC*/
void UAGE_AutoExposureAndGain(UAGE_PARAM &stParam, int nBrightness, unsigned int &nGain, unsigned int &nExposure);

/************************************************************************/
/*	Single step AEC and AGC												*/
/*	Note: (1) three mode provided: AGC; AEC; combined AGC and AEC		*/
/*		  (2) suitable for use when camera working in trigger mode		*/
/************************************************************************/
/*automatic gain control (AGC)*/
void UAGE_AutoGain_Fast(UAGE_PARAM &stParam, int nBrightness, unsigned int &nGain);

/*automatic exposure control (AEC)*/
void UAGE_AutoExposure_Fast(UAGE_PARAM &stParam, int nBrightness, unsigned int &nExposure);

/*combined AEC and AGC*/
void UAGE_AutoExposureAndGain_Fast(UAGE_PARAM &stParam, int nBrightness, unsigned int &nGain, unsigned int &nExposure);

/************************************************************************/
/* Helper functions for automatic camera control                        */
/************************************************************************/
/*Calculate mean brightness*/
bool UAGE_GetMeanBrightness(unsigned char *pImgBuf, int nImgWidth, int nImgHeight, 
						   UAGE_COLOR_MODE nColorMode, int &nBrightness);

/*Calculate mean brightness in ROI*/
bool UAGE_GetMeanBrightness(unsigned char *pImgBuf, int nImgWidth, int nImgHeight, 
						   int nROIStartX, int nROIStartY, int nROIWidth, int nROIHeight,
						   UAGE_COLOR_MODE nColorMode, int &nBrightness);


#endif /*_UN_AUTO_CAMERA_CONTROL_H*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -