如何用笔记本opencv编程调用手机摄像头
1、笔记本可以用蓝牙连接手机调用摄像头吗?要如何做?(需要什么驱动编程还是什么软件?)
2、用数据线连接手机调用?(需要什么驱动编程还是什么软件?)
谢谢大家~
只要是其他程序能够在电脑上面打开的,好像都行,直接用opencv打开就行,opencv2.3.1之后的版本都集成了directshow
代码类似这样:
#include "stdafx.h"
#include <core\core.hpp>
#include <highgui\highgui.hpp>
#include <imgproc\imgproc.hpp>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
////////////////////////////////////////////////
//Open Multi-Camera in OpenCV2.3.1
////////////////////////////////////////////////
IplImage* pFrame[4] = {NULL,NULL,NULL,NULL};
CvCapture* pCapture[4] = {NULL,NULL,NULL,NULL};
cvNamedWindow("Camera1",0);
cvNamedWindow("Camera2",0);
cvNamedWindow("Camera3",0);
//cvNamedWindow("Camera4",0);
cvResizeWindow("Camera1",300,300);
cvResizeWindow("Camera2",300,300);
cvResizeWindow("Camera3",300,300);
//cvResizeWindow("Camera4",300,300);
cvMoveWindow("Camera1",0,0);
cvMoveWindow("Camera2",0,330);
cvMoveWindow("Camera3",310,0);
//cvMoveWindow("Camera4",310,330);
pCapture[0] = cvCaptureFromCAM(0);
pCapture[1] = cvCaptureFromCAM(1);
pCapture[2] = cvCaptureFromCAM(2);
//pCapture[3] = cvCaptureFromCAM(3);
while(1)
{
pFrame[0] = cvQueryFrame(pCapture[0]);
pFrame[1] = cvQueryFrame(pCapture[1]);
pFrame[2] = cvQueryFrame(pCapture[2]);
//pFrame[3] = cvQueryFrame(pCapture[3]);
cvShowImage("Camera1",pFrame[0]);
cvShowImage("Camera2",pFrame[1]);
cvShowImage("Camera3",pFrame[2]);
//cvShowImage("Camera4",pFrame[3]);
char c = cvWaitKey(10);
if(c == 27)
{
break;
}
}
cvReleaseImage(&pFrame[0]);
cvReleaseImage(&pFrame[1]);
cvReleaseImage(&pFrame[2]);
//cvReleaseImage(&pFrame[3]);
cvReleaseCapture(&pCapture[0]);
cvReleaseCapture(&pCapture[1]);
cvReleaseCapture(&pCapture[2]);
//cvReleaseCapture(&pCapture[3]);
cvDestroyAllWindows();
return 0;
}
http://blog.csdn.net/chenyusiyuan/article/details/4744097
试试这个,行不行,本身的摄像头可能驱动什么的opencv打不开,换个外置usb的试试