基于opencv网络摄像头在ubuntu下的视频获取
基于opencv网络摄像头在ubuntu下的视频获取
1 工具 原料
平台 :UBUNTU12.04
安装库 Opencv-2.3
2 安装编译运行步骤
安装编译opencv-2.3 参考http://blog.csdn.net/xiabodan/article/details/23547847
提前下载OPENCV源码包
官方:http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/
我的:http://download.csdn.net/detail/xiabodan/7176253
2 |
|
解压源码包
3 |
tar -xvf OpenCV-2.4.1.tar.bz2 |
4 |
|
1 |
|
2 |
cd build |
3 |
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON .. |
然后进行make
1 |
make |
2 |
sudo make install |
配置opencv
1 |
sudo gedit /etc/ld.so.conf.d/opencv.conf |
Add the following line at the end of the file(it may be an empty file, that is ok) and then save it: 在opencv.conf中添加以下路径
1 |
/usr/local/lib |
sudo ldconfig
1 |
|
Add these two lines at the end of the file and save it: 在bash.bashrc中添加以下环境变量
1 |
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig |
2 |
export PKG_CONFIG_PATH |
sudo reboot 重启电脑
注意:一定要提前安装V4L等等库,不然编译能过,运行的时候没有画面。
3 测试代码
编译
g++ cameraCaptrue.cpp -o cameraCap `pkg-config --libs --cflags opencv`
生成文件cameraCap
运行 采集成功
./cameraCap
cameraCaptrue.cpp
#include<stdio.h>
#include<math.h>
#include "highgui.h"
#include <cv.h>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp> //#include <cvaux.h>
//#include <highgui\highgui_c.h>
//#include <core\types_c.h>
//#include <photo\photo_c.h>
//#include <imgproc\imgproc_c.h>
//#include <photo\photo using namespace cv; int main( int argc, char** argv )
{
printf("I am start \n");
VideoCapture cap(0); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1; printf("%f, %f\n",cap.get(CV_CAP_PROP_FRAME_WIDTH),cap.get(CV_CAP_PROP_FRAME_HEIGHT));
cap.set(CV_CAP_PROP_FRAME_WIDTH, 320);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 240);
cap.set(CV_CAP_PROP_FPS, 15);
printf("%f, %f\n",cap.get(CV_CAP_PROP_FRAME_WIDTH),cap.get(CV_CAP_PROP_FRAME_HEIGHT));
Mat src_gray;
cvNamedWindow( "video", CV_WINDOW_AUTOSIZE ); while(1)
{
Mat frame;
cvWaitKey(10);
cap >> frame;
imshow("video", frame);
} return 0;
}
接下来移植到zedboard上去
参考:
http://www.cnblogs.com/liu-jun/archive/2013/12/24/3489675.html
http://xuxd32.blog.163.com/blog/static/48121933201192394550140/
ZedBoard-OpenCV打开摄像头失败解决方案及过程:
http://www.openhw.org/wicoboy/blog/13-04/293302_71692.html
http://www.cnblogs.com/surpassal/
OpenCV移植到ARM 全过程 :点击打开链接
【OpenHW12参赛手记】Zedboard-Linux-digilent3.6内核版本不支持USB摄像头问题的解决方案 :http://www.eefocus.com/jefby1990/blog/13-03/292301_988aa.html点击打开链接
基于opencv网络摄像头在ubuntu下的视频获取的更多相关文章
- 基于opencv在摄像头ubuntu根据视频获取
基于opencv在摄像头ubuntu根据视频获取 1 工具 原料 平台 :UBUNTU12.04 安装库 Opencv-2.3 2 安装编译执行步骤 安装编译opencv-2.3 參考h ...
- [学习OpenCV攻略][002][Ubuntu下OpenCV安装]
配置环境 操作系统 Ubuntu 12.04 OpenCV版本 opencv-1.0.0 学习书籍 <学习OpenCV> Liunx软件安装方法主要有3种: 1.编译安装,也就是通过编译源 ...
- 【转】用opencv使摄像头在30fps下捕获1080p的数据
原文:http://blog.sina.com.cn/s/blog_9b493e7b0102xvn6.html opencv可以捕获摄像头数据.如果要读高分辨率和高帧率,可以用如下的设置: captu ...
- 基于OpenCV读取摄像头进行人脸检测和人脸识别
前段时间使用OpenCV的库函数实现了人脸检测和人脸识别,笔者的实验环境为VS2010+OpenCV2.4.4,opencv的环境配置网上有很多,不再赘述.检测的代码网上很多,记不清楚从哪儿copy的 ...
- 基于opencv的摄像头的标定
四个坐标系分别为:世界坐标系(Ow),摄像机坐标系(Oc),图像物理坐标系(O1,单位mm),图像像素坐标系(O,位于视野平面的左上角,单位pix). 空间某点P到其像点p的坐标转换过程主要是通过这四 ...
- 基于OpenCV依次读取文件夹下的所有图像文件
//编程环境:VS2008+OpenCV1.1, //本程序首先挨个读取F://my face database//OnlyFace文件夹下的所有图 像 文件,之后,在项目文件夹下 //建立一 个名为 ...
- ubuntu下C/C++获取剩余内存
#include <stdio.h> #include <unistd.h> long get_memory_usage() { long page_size = syscon ...
- ubuntu下网页视频或音频无法播放
有时,网页的音频或视频内容在 Firefox 下无法正常下载和播放.所需的插件没找到.过期.被阻止.和其他插件或扩展冲突,或者是内容由于某种原因被阻止.本文会帮助你解决这些问题. Flash 插件 F ...
- 关于ubuntu下看视频中文字幕乱码的问题
试了几个播放器都不行.....然后把字幕文件打开后重新保存成utf-8的.... 可以了!!!! 天呐改编码真是一个万能的办法~ 随手记
随机推荐
- HtmlparseUtil.java
该类并不是一个通用的工具类,需要按自己的要求实现,这里只记录了Htmlparse.jar包的一些用法.仅此而已! 详细看这里:http://gundumw100.iteye.com/blog/7043 ...
- RPM软件包制作
参考网站:How to create an RPM package/zh-cn[教程]https://fedoraproject.org/wiki/How_to_create_an_RPM_packa ...
- 把Nginx加为系统服务(service nginx start/stop/restart)
1.编写脚本,名为nginx #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - ...
- C++学习27 用全局函数重载运算符
运算符重载函数既可以声明为类的成员函数,也可以声明为所有类之外的全局函数. 运算符重载函数作为类的成员函数 将运算符重载函数声明为类的成员函数时,二元运算符的参数只有一个,一元运算符不需要参数.之所以 ...
- Django下载中文名文件:
Django下载中文名文件: from django.utils.http import urlquote from django.http import HttpResponse content = ...
- [datatable]两个DataTable 连接
using System; using System.Collections.Generic; using System.Text; using System.Data; namespace Cons ...
- Redis链接上不的问题
问题描述: 同样配置的redis及系统环境,在两台服务器(A.B两台服务)上部署,但是其中一台(A),运行一段时间,就链接不上了,从开始运行redis到redis链接不上,这个时间间隔,不一定有时候是 ...
- echart 图表 在.net中生成图片的方法
经过中午近两个小时的努力,终于可以实现了:echart 图表 在.net中生成图片 以下源代码: 前台页面: <!DOCTYPE html><html><head> ...
- ELK+redis集群搭建
ELK版本: logstash-1.4.2 kibana-4.0.3 redis-3.0.0 elasticsearch-1.4.4(最低版本) 分别启动命令: redis-server redis. ...
- LLDB命令查看内存的分配历史
(lldb) script import lldb.macosx.heap(lldb) malloc_info --stack-history 0x10010d680