#include "opencv2/highgui/highgui.hpp"
#include <iostream> using namespace cv;
using namespace std; int main(int argc, char* argv[])
{
VideoCapture cap(); // open the video camera no. 0 if (!cap.isOpened()) // if not success, exit program
{
cout << "Cannot open the video cam" << endl;
return -;
} double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH); //get the width of frames of the video
double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video cout << "Frame size : " << dWidth << " x " << dHeight << endl; namedWindow("MyVideo",CV_WINDOW_AUTOSIZE); //create a window called "MyVideo" while ()
{
Mat frame; //bool bSuccess = cap.read(frame); // read a new frame from video // if (!bSuccess) //if not success, break loop
//{
// cout << "Cannot read a frame from video stream" << endl;
// break;
//}
cap>>frame;
imshow("MyVideo", frame); //show the frame in "MyVideo" window if (waitKey() == ) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
{
cout << "esc key is pressed by user" << endl;
break;
}
}
return ; }

另外注明下,本人曾经想用手机来充当摄像头,利用DroidCam软件,但是貌似Opencv不支持这种方式,虽然运行代码后能够找到摄像头,但是始终无法正常显示图像,后来换了一个摄像头就完全可以正常显示了。不知道有哪位大大给解释下

最新文章

  1. java 泛型
  2. 序列化Image到byte[]
  3. poj 3311 tsp入门
  4. ==与equals()的区别
  5. linux 下的使用 ln 创建 软链接 和 硬链接
  6. C++拾遗(四)指针相关
  7. jquery正则表达式显示文本框输入范围 只能输入数字、小数、汉字、英文字母的方法
  8. (原)Eclipse中将JNI生成的so打包成jar的步骤
  9. fineui webform
  10. java8 快速实现List转map 、分组、过滤等操作
  11. kettle 在javascrip代码组件中使用fireToDB()函数实现自定义数据库查询
  12. SQL SERVER 查看数据库安装时间
  13. JavaScript原生秒表、计时器
  14. Oracle简单触发器应用
  15. (转)Maven学习总结(八)——使用Maven构建多模块项目
  16. ps 如何将视频转换成gif?
  17. 插件PageHelper实现分页查询
  18. JavaScript总结(三)
  19. C#汉字转拼音,可识别多音字,带声调,提供正向、逆向、双向分词算法的小程序
  20. 如何在MyEclipse中建立一个代理服务器

热门文章

  1. [IOS]Swift 遍历预制的本地资源文件
  2. Mac环境下Octopress个人博客搭建
  3. phpstudy虚拟机配置
  4. js实现div居中
  5. 初识CoreData与详解
  6. Struts 2的OGNL的根对象
  7. Skyshop: Image-Based Lighting Tools &amp; Shaders插件调整反射光不明显的模型
  8. python将图片转换为Framebuffer裸数据格式(终端显示图片)
  9. 有Maple T.A.自有试题图so easy
  10. 关于HTML是什么,能做什么