资源简介
程序是用Labwindows使用USB摄像头的方法,可一实时预览,并且能捕获和抓拍。
![](http://www.nz998.com/pic/39249.jpg)
代码片段和文件信息
#include “windows.h“
#include “CapturePicture.h“
#include
#include
#include
#include “video.h“
//设置所需要摄像头的常量
#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;
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);
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:
//获得面板句柄
GetPanelAttribute (panelHandle ATTR_SYSTEM_WINDOW_HANDLE handle);
//获得屏幕中图像要显示的位置
GetCtrlAttribute (panelHandle PANEL_CANVAS_TV ATTR_LEFT left);
GetCtrlAttribute (panelHandle PANEL_CANVAS_TV ATTR_TOP top);
GetCtrlAttribute (panelHandle PANEL_CANVAS_TV ATTR_HEIGHT height);
GetCtrlAttribute (panelHandle PANEL_CANVAS_TV ATTR_WIDTH width);
//打开摄像头
result = capCreateCaptureWindowA(““WS_CHILD | WS_VISIBLE lefttopwidthheighthandle0);
//设置摄像头函数
SendMessage((HWND)result WM_CAP_SET_CALLBACK_VIDEOSTREAM 0 0);
SendMessage((HWND)result WM_CAP_SET_CALLBACK_ERROR 0 0);
SendMessage((HWND)result WM_CAP_SET_CALLBACK_STATUSA 0 0);
SendMessage((HWND)result WM_CAP_DRIVER_CONNECT 0 0);
SendMessage((HWND)result WM_CAP_SET_SCALE 1 0);
SendMessage((HWND)result WM_CAP_SET_PREVIEWRATE 66 0);
SendMessage((HWND)result WM_CAP_SET_OVERLAY 1 0);
SendMessage((HWND)result WM_CAP_SET_PREVIEW 1 0);
br
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 135168 2005-09-14 14:43 video\CapturePicture.dll
文件 520 2010-01-13 22:53 video\CapturePicture.h
文件 266992 2004-08-12 17:20 video\CapturePicture.lib
文件 7948 2010-01-13 22:46 video\video.c
文件 3198 2010-01-21 11:44 video\video.cws
文件 907 2010-01-11 17:33 video\video.h
文件 4609 2010-01-13 22:46 video\video.prj
文件 992 2010-01-11 17:33 video\video.uir
目录 0 2010-01-21 11:44 video
----------- --------- ---------- ----- ----
420334 9
相关资源
- delphi摄像头拍照
- 虚拟摄像头VCam开发SDK
- 大华摄像头抓图录像亲测可用
- Labwindows/CVI下Excel打开、读写操作
- STM32F103实现OV7670摄像头显示
- amcap摄像头驱动
- 海康摄像头+web3.0开发包SDK的demo
- 戴尔Inspiron笔记本 摄像头工具webcam
- 万能摄像头驱动程序 最新版
- USB摄像头万能驱动器 v2011.3 官方最新
- dell inspiron n4010摄像头驱动 官方最新版
- ASUS华硕笔记本万能摄像头驱动 2012 完
- 华硕笔记本万能摄像头驱动v2.0官方正
- EyeToy SCEH-0004 摄像头驱动
- 500万像素手机摄像头优化设计
- 华硕ASUS K42JZ摄像头驱动程序 v061.005
- 基于K60的线性CCD摄像头的自主循迹平
- 基于STM32平台配置OV7620摄像头,并采集
- 用两个摄像头实现,双目标定,双目
- 摄像头测试 24色卡 Color24.rar
- ov7725彩色摄像头显示图像k60源码
- FFmpeg 采集摄像头输出rtmp直播流媒体,
- 使用FFmpeg采集摄像头图像和麦克风音
- 国外开源视频监控iSpy源代码20180905
- FFmpeg获取网络摄像头数据解码
- IDCardOCR_China 基于tesseract,实现摄像头
- 树莓派运用CV摄像头、视觉巡线.zip
- 使用RTMPdump(libRTMP)直播来自v4l2的摄
- 301摄像头万能驱动程序(pc camera 301
- .net 调用摄像头代码
评论
共有 条评论