资源简介

使用VC设计了基于OpenCV的摄像头云台控制系统 实现了运动跟踪、运动报警、抓拍、手动云台控制、云台状态显示、摄像头设置和实时曲线绘制等功能。

资源截图

代码片段和文件信息

#include 
#include 

#define CMD    ‘O‘ 
#define END    ‘E‘
#define INVAIL    0
#define READY    ‘R‘
#define BUSY    ‘B‘


#define CONNECT    ‘C‘  //连接
#define WAIT    ‘W‘  //等待
#define MOVEX    ‘X‘ //X移位
#define MOVEY    ‘Y‘ //Y移位
#define MOVEXY    ‘P‘ //X-Y移位

#define  uchar    unsigned char
#define  EOS    ‘A‘
#define BUFFLEN    40
#define CMDLEN    5

struct COMMAND{        //指令结构
       uchar cmd;
   uchar dat1;
   uchar dat2;
   };

uchar buff[BUFFLEN]bcnt=00bhead=0bend=0;   //接受数据缓存 及计数器
unsigned char ccnt=0;   //指令队列计数器
struct COMMAND cmd_buff[15]={{000}};      //指令队列

void Send_Str(uchar * str);

void showbuff(void){
  char i;
Send_Str(“ [Buff: A“);
for(i=0;i {
if(buff[i]==INVAIL) putchar(‘-‘);
else putchar(buff[i]);
}
Send_Str(“ ] A“);
putchar(‘ ‘);
}

void Cmd_buffPro(void)
 {uchar ij=0tbendt=0f=0;
  tbend=bcnt;
  i=bhead;
  
  while(i!=tbend)
   {tbend=bcnt;
if(buff[i]==CMD)
{
f=1;

if(bhead<=tbend)
{
if((((i+CMDLEN-1)%BUFFLEN>bhead)&&((i+CMDLEN-1)%BUFFLEN }else {
  if((((i+CMDLEN-1)%BUFFLEN>bhead)||((i+CMDLEN-1)%BUFFLEN   }
if(t)
{
if(buff[(i+CMDLEN-1)%BUFFLEN]==END)
{
f=0;

  //Send_Str(“ [CMD] A“);j++;
//putchar(j+‘0‘);
 
  ccnt=ccnt+1;buff[i%BUFFLEN]=INVAIL;
  cmd_buff[ccnt].cmd =buff[(i+1)%BUFFLEN];buff[(i+1)%BUFFLEN]=INVAIL;
  cmd_buff[ccnt].dat1=buff[(i+2)%BUFFLEN];buff[(i+2)%BUFFLEN]=INVAIL;
  cmd_buff[ccnt].dat2=buff[(i+3)%BUFFLEN];buff[(i+3)%BUFFLEN]=INVAIL;
  buff[(i+4)%BUFFLEN]=INVAIL;
 
  bhead=((i+CMDLEN)%(BUFFLEN)); 
  i=bhead; 

  //putchar(‘[‘);putchar(i/10+‘0‘);putchar(i%10+‘0‘);putchar(‘]‘);
  //putchar(‘[‘);putchar(tbend/10+‘0‘);putchar(tbend%10+‘0‘);putchar(‘]‘);
}else {
   f=0;buff[i]=INVAIL;
  }
}
}else{
  if(f==0)buff[i]=INVAIL;
  i++;
  i=i%BUFFLEN;bhead=i;
 }
}
 
 }
 
void Cmd_pro(void)
 {uchar i;
 
 if(ccnt>0)
  {
  for(i=0;i   {
cmd_buff[i].cmd=cmd_buff[i+1].cmd;
cmd_buff[i].dat1=cmd_buff[i+1].cmd;
cmd_buff[i].dat2=cmd_buff[i+1].cmd;

putchar(‘[‘);putchar((‘0‘+ccnt));
Send_Str(“:proCMD] A“);
putchar(cmd_buff[0].cmd);

}
 ccnt--;

  switch(cmd_buff[0].cmd)
  {
case CONNECT:Send_Str(“connect A“);break;
case WAIT :Send_Str(“waiting A“);break;
case MOVEX :Send_Str(“movex A“);break;
case MOVEY :Send_Str(“movey A“);break;
case MOVEXY :Send_Str(“movexy A“);break;
default:Send_Str(“Inlegal Command!A“);break;
}
  }
 }
 
#pragma interrupt_handler ReceivePro:19
void ReceivePro(void)   //串口接受中断服务程序
{
buff[bcnt]=UDR0;
bcnt++;
bcnt=bcnt%(BUFFLEN);

showbuff();
//putchar(‘[‘); putchar(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        105  2009-08-01 09:49  源码00\说明.txt

     文件     179704  2004-08-17 12:00  源码00\自动跟踪改进DM_CtrlPad\a.wav

     文件      11232  2009-05-04 15:10  源码00\自动跟踪改进DM_CtrlPad\commondialog.cpp

     文件       3239  2009-05-04 15:10  源码00\自动跟踪改进DM_CtrlPad\commondialog.h

     文件      29272  2009-07-26 10:01  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.aps

     文件       5996  2009-07-26 10:02  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.clw

     文件       2119  2009-04-29 15:21  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.cpp

     文件       7188  2009-05-30 19:53  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.dsp

     文件        677  2009-05-04 15:38  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.dsw

     文件       1368  2009-04-29 15:21  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.h

     文件     476160  2009-07-26 10:03  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.ncb

     文件      53760  2009-07-26 10:03  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.opt

     文件        254  2009-06-04 10:09  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.plg

     文件      13512  2009-05-30 20:49  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPad.rc

     文件      46163  2009-06-04 08:47  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPadDlg.cpp

     文件       3212  2009-06-01 16:20  源码00\自动跟踪改进DM_CtrlPad\DM_CtrlPadDlg.h

     文件       1445  2009-05-04 10:52  源码00\自动跟踪改进DM_CtrlPad\DM_SFOptionDlg.cpp

     文件       1332  2009-05-04 10:50  源码00\自动跟踪改进DM_CtrlPad\DM_SFOptionDlg.h

     文件       2504  2009-05-10 18:14  源码00\自动跟踪改进DM_CtrlPad\DM_SFOptionDlgCapture.cpp

     文件       1465  2009-05-10 18:08  源码00\自动跟踪改进DM_CtrlPad\DM_SFOptionDlgCapture.h

     文件       2225  2009-05-10 18:18  源码00\自动跟踪改进DM_CtrlPad\DM_SFOptionDlgPhoto.cpp

     文件       1430  2009-05-10 18:16  源码00\自动跟踪改进DM_CtrlPad\DM_SFOptionDlgPhoto.h

     文件       2364  2009-05-28 22:56  源码00\自动跟踪改进DM_CtrlPad\DM_SFOptionDlgWarn.cpp

     文件       1414  2009-05-28 22:40  源码00\自动跟踪改进DM_CtrlPad\DM_SFOptionDlgWarn.h

     文件       2098  2009-04-29 16:14  源码00\自动跟踪改进DM_CtrlPad\font.cpp

     文件       1461  2009-04-29 16:14  源码00\自动跟踪改进DM_CtrlPad\font.h

     文件       8569  2009-04-29 16:14  源码00\自动跟踪改进DM_CtrlPad\mscomm.cpp

     文件       3221  2009-04-29 16:14  源码00\自动跟踪改进DM_CtrlPad\mscomm.h

     文件        486  2009-05-30 19:39  源码00\自动跟踪改进DM_CtrlPad\objecttrack.h

     文件       2209  2009-04-29 16:14  源码00\自动跟踪改进DM_CtrlPad\oleobject.cpp

............此处省略40个文件信息

评论

共有 条评论