OpenCV count the number of connected camera 检测连接的摄像头的数量
有时候在项目中我们需要检测当前连接在机子上的摄像头的数量,可以通过下面的代码实现,其中连接摄像头的最大数量maxCamNum可以任意修改:
- /**
- * Count current camera number
- */
- int countCamera() {
- int maxCamNum = ;
- int count = ;
- for(int device = ; device < maxCamNum; device++)
- {
- CvCapture* capture;
- if (_capture[device]) {
- ++count;
- }
- else {
- capture = cvCaptureFromCAM(CV_CAP_DSHOW + device);
- if (capture) {
- ++count;
- }
- cvReleaseCapture(&capture);
- }
- }
- return count;
- }
OpenCV中没有能返回摄像头设备名称的函数,有些时候也不太方便,但是没有办法,将就的用着吧~~
OpenCV count the number of connected camera 检测连接的摄像头的数量的更多相关文章
- LeetCode Number of Connected Components in an Undirected Graph
原题链接在这里:https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/ 题目: Giv ...
- [Swift]LeetCode323. 无向图中的连通区域的个数 $ Number of Connected Components in an Undirected Graph
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...
- 323. Number of Connected Components in an Undirected Graph按照线段添加的并查集
[抄题]: Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of n ...
- LeetCode 323. Number of Connected Components in an Undirected Graph
原题链接在这里:https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/ 题目: Giv ...
- 323. Number of Connected Components in an Undirected Graph (leetcode)
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...
- [LeetCode] 323. Number of Connected Components in an Undirected Graph 无向图中的连通区域的个数
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...
- [LeetCode] Number of Connected Components in an Undirected Graph 无向图中的连通区域的个数
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...
- [geeksforgeeks] Count the number of occurrences in a sorted array
Count the number of occurrences in a sorted array Given a sorted array arr[] and a number x, write a ...
- [Locked] Number of Connected Components in an Undirected Graph
Number of Connected Components in an Undirected Graph Given n nodes labeled from 0 to n - 1 and a li ...
随机推荐
- Top K Frequent Elements
Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2 ...
- Rehashing
The size of the hash table is not determinate at the very beginning. If the total size of keys is to ...
- TCP的几个状态 (SYN, FIN, ACK, PSH, RST, URG)
在TCP层,有个FLAGS字段,这个字段有以下几个标识:SYN, FIN, ACK, PSH, RST, URG. 其中,对于我们日常的分析有用的就是前面的五个字段. 它们的含义是: SYN表示建立连 ...
- myeclipse高版本对应tomcat低版本解决办法
今天在帮同事调试程序的时候,冒出来一个异常,网上搜搜,结果如下: 将项目部署好后,启动tomcat后报错,java.lang.NoClassDefFoundError: org/apache/juli ...
- javamail实现邮箱验证功能
javamail是基于SMTP协议和POP3协议的邮件发送与接收系统,在用户注册与登陆的过程中,常需要用到邮箱验证功能,下面是基于javamail的一个简单实现 用户注册后通过servlet得到邮箱地 ...
- Virtual Box创建共享目录
1.先关闭ubuntu,在virtualbox“设置”中找到“共享文件夹”,点击进入,点击右边添加目录按钮,添加windows中要共享的目录,取一个名.比如我在D盘建一个名为share的文件夹,如下图 ...
- oracle 卸载步骤(图解)
1.卸载第一步:点击开始菜单: 步骤阅读 2 2.点击Universal Installer来实现下面 步骤阅读 3 3.点击卸载产品后出现的内容: 步骤阅读 4 4.点击打开Oracle主目录下的O ...
- hdu 2639 第k大01背包
求每个状态里的k优解,然后合并 /* HDU 2639 求01背包的第k大解. 合并两个有序序列 */ #include<stdio.h> #include<iostream> ...
- C# GUID
全局唯一标识符,简称GUID,是一种由算法生成的唯一标识.GUID的主要目的是产生完全唯一的数字. 生产GUID语句: System.Guid.NewGuid().ToString();
- LightOJ 1079 Just another Robbery 概率背包
Description As Harry Potter series is over, Harry has no job. Since he wants to make quick money, (h ...