opencv 设置摄像头分辨率
2015-08-22 19:32
344 查看
使用函数cv::VideoCapture::set()函数设置摄像头的分辨率
#include "cartoon.h" int main() { VideoCapture capture(0); if (!capture.isOpened()) { //判断能够打开摄像头 cout<<"can not open the camera"<<endl; cin.get(); exit(1); } capture.set(CV_CAP_PROP_FRAME_WIDTH, 640); capture.set(CV_CAP_PROP_FRAME_HEIGHT, 480); int count=0; while (1) { Mat frame; capture>>frame; //载入图像 if (frame.empty()) { //判断图像是否载入 cout<<"can not load the frame"<<endl; } else { count++; if (count == 1) { cout<<frame.cols<<" "<<frame.rows<<endl; } imshow("camera", frame); char c=waitKey(30); //延时30毫秒 if (c == 27) //按ESC键退出 break; } } }
相关文章推荐
- 8月22日 19个常用命令的简单解释
- 多线程 - 10.NSOperation的使用示例
- shell 常见的系统环境变量解析
- 多线程 - 09.NSOperation基本使用
- linux问题总结
- linux命令
- mac基础终端命令入门
- Android驱动之 Linux Input子系统之TP——A/B(Slot)协议
- 我的centos 软件源
- PowerShell命令卸载Win10内置应用
- Apache2 使用Tips
- 一个百万级PHP站点的网站架构
- VC6.0应用OpenCV时出现的错误及解决办法
- nginx均衡后端两台lamp,并做动静分离
- linux(Debian) 中的cron计划任务配置方法
- Atitit.故障排除系列---php 计划网站数据库错误排除过程
- 深入理解LInux内核-进程通信
- Linux 软连接与硬连接
- 【裤子】国外婚外恋网站被黑 3600万会员中有180万日本人
- Shell 的变量功能