-
大小: 250KB文件类型: .rar金币: 2下载: 0 次发布日期: 2021-06-14
- 语言: 其他
- 标签: cvi labwindows USB 射像头
资源简介
CVI对普通USB摄像头的控制代码,程序和代码,很不错的!值得学习

代码片段和文件信息
/*****************************************************************
* *
* 基于LabWindows/CVI的摄像头控制技术--实现屏幕截图、录像功能 *
* *
* 代码参考自:http://blog.sina.com.cn/u/4b677075010006da *
* *
* 本人是菜鸟,如有不对的地方,请多指教! *
* *
******************************************************************/
#include “windows.h“
#include “avicap32.h“
#include
#include
#include “cam.h“
#define Control_enabled 0
#define Control_disabled 1
//设置所需要摄像头的常量
#define WM_CAP_START WM_USER //开始
#define WM_CAP_STOP WM_CAP_START + 68 //停止
#define WM_CAP_DRIVER_CONNECT WM_CAP_START + 10 //连接
#define WM_CAP_DRIVER_DISCONNECT WM_CAP_START + 11 //断开
#define WM_CAP_SAVEDIB WM_CAP_START + 25
#define WM_CAP_GRAB_frame WM_CAP_START + 60
#define WM_CAP_SEQUENCE WM_CAP_START + 62
#define WM_CAP_FILE_SET_CAPTURE_FILEA WM_CAP_START + 20 //保存至文件
#define WM_CAP_SEQUENCE_NOFILE WM_CAP_START + 63
#define WM_CAP_SET_OVERLAY WM_CAP_START + 51
#define WM_CAP_SET_PREVIEW WM_CAP_START + 50
#define WM_CAP_SET_CALLBACK_VIDEOSTREAM WM_CAP_START +6
#define WM_CAP_SET_CALLBACK_ERROR WM_CAP_START +2
#define WM_CAP_SET_CALLBACK_STATUSA WM_CAP_START +3
#define WM_CAP_SET_CALLBACK_frame WM_CAP_START +5
#define WM_CAP_SET_SCALE WM_CAP_START+ 53
#define WM_CAP_SET_PREVIEWRATE WM_CAP_START+ 52
#define WM_CAP_COPYDIB WM_CAP_START + 30 //复制图片
//定义面板句柄
static int handle;
//定义摄像头句柄
static int result;
static int panelHandle;
//定义CANVAS_TV初始位置
static int canvas_tv_x;
static int canvas_tv_y;
int main(int argc char *argv[]) {
if (InitCVIRTE(0 argv 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel(0 “cam.uir“ PANEL)) < 0)
return -1;
DisplayPanel(panelHandle);
GetCtrlAttribute(panelHandle PANEL_CANVAS_TV ATTR_LEFT &canvas_tv_x); //重定位CANVAS_TV要用到
GetCtrlAttribute(panelHandle PANEL_CANVAS_TV ATTR_TOP &canvas_tv_y);
//320*240制式
SetCtrlAttribute(panelHandle PANEL_CANVAS_TV ATTR_WIDTH 320);
SetCtrlAttribute(panelHandle PANEL_CANVAS_TV ATTR_HEIGHT 240);
//重新定位
SetCtrlAttribute(panelHandle PANEL_CANVAS_TV ATTR_LEFT (592-320)/2+canvas_tv_x);
SetCtrlAttribute(panelHandle PANEL_CANVAS_TV ATTR_TOP (333-240)/2+canvas_tv_y);
RunUserInterface();
DiscardPanel(panelHandle);
return 0;
}
//退出按钮
int CVICALLBACK QuitCallback(int panel int control int event
void *callbackData int eventData1 int eventData2) {
switch (event) {
case EVENT_COMMIT:
QuitUserInterface(0);
break;
}
return 0;
}
//开始按钮
int CVICALLBACK startCB(int panel int control int event
void *callbackData int eventData1 int eventData2) {
int width;
int height;
int top;
int left;
switch (event) {
case EVENT_COMMIT:
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3091 2007-04-17 11:40 Capture.cws
文件 3895 2007-04-17 11:34 Capture.prj
文件 1213 2007-04-10 21:32 avicap32.h
文件 2102 2007-04-10 16:23 avicap32.lib
文件 2510 2007-04-17 11:39 cam.h
文件 15428 2007-04-17 11:39 cam.uir
文件 11718 2007-04-17 09:13 Capture.c
文件 982134 2007-04-17 10:18 界面.bmp
----------- --------- ---------- ----- ----
1022091 8
相关资源
- 遍历USB设备,获取USB序列号
- 联想lenovo G480 USB3.0驱动程序 for win7
- TPC-ZK系列USB学生实验指导书
- usb hid调试工具
- HID调试助手
- USB.Over.Network.Server 注册机
- WPF USB 网络 串口 通信软件
- USB转串口驱动,FT232R驱动程序,最新
- WinCE下CP210x的驱动程序
- hidusage.h hidpi.h 等USB开发用头文件
- 基于JM20329的SATA转USB 1394
- 430系列单片机USBFET下载驱动
- CVI下的TCP服务器和客户端
- CY7C68013A固件程序(用于摄像机采集)
- usb调试程序 对USB设备进行数据的读写
- USB 驱动 让电脑与arm进行通信
- USB助手(调试USB通信协议的工具) 源
- 基于FPGA的USB接口设计
- 枚举USB设备接口(C 源代码)
- 多普达USB Modem驱动(适用于818、828、
- SN9C291B datasheet
- 希捷公布USB外部硬盘解决方案
- USB调试模式一键设置
- USB网卡驱动 USB2.0 TO Fast Ethernet Adapte
- USB转串口(RS232/RS485/RS422)驱动程序文
- USB Type-C SPEC
- H310.B360.H370.Z390.USB WIN7 64位第三方驱动
- 300系列WIN7 USB驱动.7z
- 华硕P8H61/USB3 R2.0主板BIOS驱动 免费版
- RTL8188EVT USB WIFI无线网卡驱动 免费版
评论
共有 条评论