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

📄 simpapi13.txt

📁 AVE1000S系列卡SDK&Driver
💻 TXT
📖 第 1 页 / 共 5 页
字号:
							//报警灵敏度,越小越灵敏;与摄像物体的距离,大小和摄像头的质量有关;
							//需在具体环境中测试好。如果出现虚警,请将该值调大;如出现漏警,则将该值调小。
							//微调灵敏度
		int				intervaltime;//the interval of the alter time;when the alert begin,the detect thread stop calculate
							//until the time arrived.
							//报警间隔时间;从发现警情时刻开始记时,到intervaltime秒这段时间
							//用户可根据需要在报警回调函数进行警情处理,在这段时间内报警线程停止分析数据检测。
		int				nblock;// 0-15
							//报警灵敏度,越小越灵敏;与摄像物体的距离,大小和摄像头的质量有关;
							//需在具体环境中测试好。如果出现虚警,请将该值调大;如出现漏警,则将该值调小。
							//宏调灵敏度
		///////////////////////////////////////////////////
		int				usr_rect_num;//the usr_rect's num;
									//用户选择子区域的个数
		RECT			*usr_rect;//the user's region.
							//bAssign==TRUE;you must input the usr_rect ;
							//bAssign==FASLE;you needn't deal with it.
							//it's the client coordinate
							//用户定义区域;这是客户区坐标;如果bAssign==TRUE,你必须对该项设置;
                            //如果bAssign==FALSE;则不必对该项处理。其子区域数由usr_rect_num指定
		
}USRDETECTINFO;

typedef struct {
		int  Card;//与输入主区域号和子区域号对应的卡号
		int  Channel;//与输入主区域号和子区域号对应的通道号
		RECT  Mainrect;//主区域屏幕坐标
		RECT Subrect;//子区域客户坐标
		HWND hWnd;//与区域对应的窗口句柄
		} DispParams;//输入主区域号和子区域号,得到相应的显示参数
					//用户通过sapiGetDispParams得到的显示参数放置在该结构中
	 DispParams;//用户通过sapiGetDispParams得到的显示参数放置在该结构中
typedef struct{
		float	left;//用户选中子区域 左顶点left与该显示区域宽度比例
		float	top;//用户选中子区域左顶点top与该显示区域高度比例
		float	bottom;//用户选中子区域右顶点bottom与该显示区域高度比例
		float	right;//用户选中子区域右顶点right与该显示区域宽度比例
		}ScaleRation;//用于存储 显示区域改变大小前后比例。
	。typedef struct {
		int MainRgnID;//主区域号
		int SubRgnID;//子区域号
		}RGNID;//用于根据用户鼠标位置得到区域号
typedef struct{
		//the next seven option will be initialized with VIDEOWINDOW or SVIDEOWINDOW;
		///////////////////////////////////////////
		BOOL			bValid; //frame if valid;when the detect thread 
							//is calculating,bValid =FALSE;else bValid=TRUE;
							//程序员不必关心和处理该成员
		HANDLE			hArriveEvent; // you must setevent(hArriveEvent)
							//in the frame interrput function ,when the frame has arrived.
							//程序员需在显示中断函数中使能该信号
		char *			pBuffer;      // the frame's address 
							//程序员需将报警处理数据首地址赋予该成员
		int				pitch;//the byte of a frame's line;
		int				pixelDepth;//the byte of a pixel;
		int				pixelFormat;//it must =0;that is to say,it's yuv format :4:2:2
							//if you have the different foramt,please change it to the YUV 4:2:2 format;
							//上述三个成员由程序员根据VIDEOWINDOW or SVIDEOWINDOW赋予。
		RECT			rect;//the rect of a frame;screen coordiante
						//it's the client coordinate
						//显示子区域客户坐标
	
		}IMAGEINFO,*PIMAGEINFO;//these params must save and synchronize with outers.

//6-2:回调函数:

	typedef void (* DETECTCALLBACK)(int MRgnID,int SRgnID,void * pUsrParam);
   用户根据此声明自己的回调函数。可每卡每路用一个回调函数,由输入的MRgnID和SRgnID参数区别是哪个区域
   出现警情,(由MRgnID和SRgnID参数可唯一的确定卡号和通道号,sapiGetDispParams函数可得)。
   参数说明:MRgnID为主区域号,SRgnID为子区域号,pUsrParam为用户自定义参数。
   功能:可在该函数中绘图,如报警时画红色小巨型提示报警;或者在此开始实现记录,用WM_TIMER消息结束记录
	或用绿色画小方框提示报警结束,现在正在检测。而时间的设置就是用户最初设置的intervalTime;可通过
   	sapiGetDetectParams获得该值。
 例:声明:void DetectInt(int MRgn,int SRgn,void * pParams);
	画方框实现:
	void DetectInt(int MRgn,int SRgn,void * pParams)
	{
	
	DispParams disp;
	RECT rect;
	USRDETECTINFO usrDetectInfo;

	sapiGetDispParams(MRgn,SRgn,&disp);//得到显示参数
	HWND hwnd=disp.hWnd; //获得显示的窗口句柄
	rect=disp.Subrect;   //得到该通道的RECT客户坐标
	DrawRect(hwnd,rect,0);//调用绘方框函数
	int num=MRgn*16+SRgn;  
	sapiGetDetectParams(MRgn,SRgn,&usrDetectInfo);//的到用户设置的参数信息
	SetTimer(hwnd,400+num,usrDetectInfo.intervaltime*1000,NULL);//设置定时函数;注意hwnd的来源,OnTimer函数应和相应的窗口联系。
	

	}

   
//6-3:函数说明:

 //6-3-1:
	//if you register a function,when the alert happened,the function will be executed.
        //用户使用该函数注册回调函数;可每卡每路用一个回调函数,由输入的MRgnID和SRgnID参数区别是哪个区域
   	//出现警情,(由MRgnID和SRgnID参数可唯一的确定卡号和通道号,sapiGetDispParams函数可得)。
	//参数说明:MRgnID为主区域号,SRgnID为子区域号,detectCallback为注册的回调函数名,pUsrParam为用户自定义参数。

	SAPI BOOL DLLCALL sapiRegisterDetectFun(int MRgnID,int SRgnID,DETECTCALLBACK detectCallback,void * pParams);
	
//6-3-2:
	//the next two functions :
	//下面两个函数为报警的启动和停止函数。
	//1.if you have the params for alert,execute the function.
	//the return value if is true,the alert sapiStartDetect success,else it failed.
	//you can use the return value to decide if you really start it.
	//1。启动函数sapiStartDetect,每卡每路均可启动报警;这里用主区域号和子区域号区分每卡每路,
 	//MRgnID为主区域号,SRgnID为子区域号。可用sapiGetDispParams获得卡号和通道号;启动报警函数
	//前,请先填充USRDETECTINFO 结构;详细说明见前面//6-1:结构;
	//返回值:为TRUE,则成功;为FALSE,启动失败。用户可通过返回值判断报警是否成功启动。
	SAPI BOOL DLLCALL sapiStartDetect(int MRgnID,int SRgnID,USRDETECTINFO userInfo);

	//2.if you want to stop the alert,execute it.
	//the return value if is FALSE,the alert sapiStartDetect success,else it failed.
	//you can use the return value to decide if you really stop it.
	//2。停止该区域的报警检测。MRgnID为主区域号,SRgnID为子区域号
	//返回值:用户可通过返回值知道报警线程是否停止;为TRUE,线程已经成功结束;
	//为FALSE,报警线程还在进行或者出现其他情况(如卡没关联,或者该区域报警没有启动),没能结束该线程。
	SAPI BOOL DLLCALL sapiStopDetect(int MRgnID,int SRgnID);

//6-3-3:
	//to decide if all the alert have stoped.
	//if the return value is true,yes,you have closed all the detect,
	//else you have some detect opended.you should stop the detect when you close the application.
	//判断是否所有路的报警均已结束。当用户改变显示方式或者退出程序时,必须先关闭打开的报警线程
	//这时,可调用该函数进行检测是否所有路的报警均已结束。为TRUE,则没有报警线程;
	//为FALSE,还有报警线程没有关闭
	SAPI BOOL DLLCALL sapiIfNoDetect();
//6-3-4
	SAPI BOOL DLLCALL sapiGetDispParams(int MRgnID,int SRgnID,DispParams * dispParams);
		//input MRgnID and SRgnID,you can get DispParams struct.
//6-3-5
	。SAPI BOOL DLLCALL sapiGetRgnID(HWND hwnd,POINT point,RGNID *rgnID);
		//input hwnd and the mouse's point,you can get the mouse in which region .
//6-3-6
	。SAPI BOOL DLLCALL sapiGetUsrInfo(int MRgnID,int SRgnID,USRDETECTINFO *usrInfo);
		//input MRgnID and SRgnID,you can get USRDETECTINFO struct
	
//6-3-7:
	//得到该区域的的显示参数DispParams结构的详细说明见前6-1
	SAPI BOOL DLLCALL sapiGetDispParams(int MRgnID,int SRgnID,DispParams * dispParams);
//6-3-8:
	//得到拥护输入的报警参数,结构的详细说明见前6-1
	SAPI BOOL DLLCALL sapiGetDetectParams(int MRgnID,int SRgnID,USRDETECTINFO * userInfo);
//6-4:注意事项:
	OnMove和OnSize中的报警不必处理,ssapi的实现中已经进行处理了。
7.压缩流报警函数,结构及其功能
 //7-1.结构:
typedef struct
{
	DWORD				*		pCompressBuffer;
           	//指向存放压缩流数据地址的存储空间。
	HANDLE				hBufReadyOKEvent;
		//压缩流数据准备好了,可以进行检测。
        //下面的三个变量用于检测是否检测到移动目标,如果检测到,需等待用户时间
	HANDLE				hBufOverEvent;
		//压缩流数据检测结束或者检测到移动目标,等待后面数据的检测。
	BOOL				bAlert;
		//为真,则检测到移动目标;否则,没有检测到。
	BOOL				bTimeOver;
                //根据用户输入的记录时间,从检测到移动目标起记时,为假,则没有到达用户所需的记录时间,
  		//,为真,则时间到达,记录结束,开始下一次检测。
}COMPRESSINFO,*PCOMPRESSINFO;
  //7-2 回调函数
   typedef void (* DETECT2CALLBACK)(int CardID,int ChannelID,int rectID,void * pUsrParam);
	用户根据此声明自己的回调函数。CardID-卡号;ChannelID-通道号;rectID-当用户选择区域时,第几块区域
        首先检测到移动目标;pUsrParam-用户自己的参数
  //7-3 函数说明
	//the next two function to switch card to region,or switch regionID to cardID;
	//if the return  value==FALSE,the display region haven't connect with card;
	//else the two have some connection ,so can get one from another.
	//由区域号获得相应的卡号;返回值为真,卡和区域相关联;返回值为假,该区域不和任何卡相关联;
	//输入:区域号MRgnID, SRgnID;获得:卡号CardID,ChannelID
  SAPI BOOL DLLCALL sapiGetCardIDFromRegionID(int MRgnID,int SRgnID,int &CardID,int &ChannelID);
	//由卡号获得相应的区域号;返回值为真,该卡和显示区域关联,关联的区域号为MRgnID, SRgnID;
	//返回值为假,该卡不和任何区域相关联。输入:卡号CardID,ChannelID;获得:区域号MRgnID, SRgnID
  SAPI BOOL DLLCALL sapiGetRegionIDFromCardID(int CardID,int ChannelID,int &MRgnID,int &SRgnID);

	//Init motiondetect2
	//初始化压缩报警流相应的参数(该卡压缩报警前必须调用,只需调用一次)
  SAPI BOOL DLLCALL sapiInitMotionDetect2(int CardID,int ChannelID);
	//析构压缩报警流(调用了sapiInitMotionDetect2,必须调用该函数,只需在程序结束调用一次)。
  SAPI BOOL DLLCALL sapiDeleteMotionDetect2(int CardID,int ChannelID);
	//first you must register for motion detect;if you want to register others,you must unregister what you have 
	//registered.
	//注册回调函数,CardID-卡号;ChannelID-通道号;回调函数-Detect2CallBack;pUsrParam-用户自己的参数
	//返回值为真,注册成功,否则,失败;必须将以前注册的回调函数反注册sapiUnRegisterDetect2Fun,再从新注册
  SAPI BOOL DLLCALL sapiRegisterDetect2Fun(int CardID,int ChannelID,DETECT2CALLBACK Detect2CallBack,void * pParams);
	//反注册回调函数。与sapiRegisterDetect2Fun成对使用。
  SAPI BOOL DLLCALL sapiUnRegisterDetect2Fun(int CardID,int ChannelID);

	//SetParams
	//设置用户压缩流报警所需的参数。USRDETECTINFO结构见6-1。
  SAPI BOOL DLLCALL sapiSetParams(int CardID,int ChannelID,USRDETECTINFO userInfo);
	//after register,SetParams for detect2 function.you can detect motion object.
	//now we integrate some function in there.
	//if bAlert==TRUE
	//{  if(bWrite==TRUE),when detect motion detect,record encoded data for userInfo.intervaltime;
	//			else   when detect motion detect,don't record encoded data.just sleep userInfo.intervaltime;
	//}
	//if(bAlert==FALSE)  //don't detect
	//{  if(bWrite==TRUE),the function as sapiStartOneCompressRec();
	//			else	don't do anything
	//}
	//notice:if you use sapiStartDetect2WithCompressRec,you can't use the same card do sapiStartOneCompressRec or sapiStartTwoCompressRec 
	//or when use sapiStartOneCompressRec or sapiStartTwoCompressRec ,you can't use sapiStartDetect2WithCompressRec
	//开始压缩流报警检测记录。可以只检测不记录,也可只记录(连续记录)不检测,也可检测到移动目标时再记录。
	//bAlert为真,则要检测,为假,则不检测;bWrite为真,则记录,否则不记录;CardID-卡号;
	//EncoderID-编码器号;pParams为stEncoderParams结构指针,stEncoderParams结构见3-3。
	
  SAPI BOOL DLLCALL sapiStartDetect2WithCompressRec(BOOL bAlert,BOOL bWrite,UINT CardID,UINT EncoderID,stEncoderParams * pParams);
	//停止压缩流报警检测记录。

⌨️ 快捷键说明

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