videoInput库+opencv+usb采集卡+监控相机

1 篇文章 0 订阅

一.设备

1.监控相机:登利路30倍变焦

2.usb采集卡:MINE Vcap2860


二:软件

1.VS2010

2.opencv2.3.1

3.videoInput库    网盘下载地址链接: http://pan.baidu.com/s/1c2gFV7E 密码: s936


三:编程测试

1.代码:

#include "stdafx.h"
#include "videoInput.h"

#include "opencv/cv.h"
#include "opencv/highgui.h"

#include <stdio.h>

#pragma comment(linker, "/NODEFAULTLIB:atlthunk.lib")


int _tmain(int argc, _TCHAR* argv[])

{

int numDevices = 0; //设备ID号

videoInput VI;//创建视对象

int num = VI.listDevices();//图像设备数量


char* Devicename = VI.getDeviceName(numDevices);

const char* name = "WDM 2860 Capture";//usb采集卡的名称

while(strcmp(name,Devicename) != 0)//找usb采集卡
{
numDevices++;
if(numDevices >= num)
{
printf("没有找到你的设备\n\n");

system("pause");
return 0;
}
Devicename = VI.getDeviceName(numDevices);
}

int width = 640;
int height= 480;

IplImage *img = cvCreateImage(cvSize(width,height), IPL_DEPTH_8U, 3);

VI.setupDevice(numDevices,width,height);//配置设备

while(1)
{
if(VI.isFrameNew(numDevices))
{
VI.getPixels(numDevices, (unsigned char *)img->imageData, false, true);//获取一帧

cvShowImage("img", img);

if(cvWaitKey(1)==27) break;//按ESC退出
}
}

return 0;

}


2.测试结果:



  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值