×

ubuntu安装opencv

ubuntu安装opencv(ubuntu怎样安装opencv3.1)

admin admin 发表于2024-01-12 23:20:00 浏览33 评论0

抢沙发发表评论

各位老铁们好,相信很多人对ubuntu安装opencv都不是特别的了解,因此呢,今天就来为大家分享下关于ubuntu安装opencv以及ubuntu怎样安装opencv3.1的问题知识,还望可以帮助大家,解决大家的一些困惑,下面一起来看看吧!

本文目录

ubuntu怎样安装opencv3.1

OpenCV 2.2以后版本需要使用Cmake生成makefile文件,因此需要先安装cmake。ubuntu下安装cmake比较简单,apt-get install cmakeapt-get install libgtk2.0-dev(下面两步安装编译必须的库)apt-get install pkg-config然后你们下载openc-2.4.3 然后 解压然后cmake-gui 进入了 ui配置界面 在路劲那里配置好你的opencv位置 和 安装路径然后点 configure 然后选中 unix makefiles 然后选 use xxxxxx compilter这跟命令行配置 cmake -D CMAKE_BUILD_TYPE=RELEASE CMAKE_INSTALL_PREFIX=/home/OpenCV 是一样的之后就是安装了 make 然后make install然后是配置变量sudo gedit /etc/ld.so.conf.d/opencv.conf最后一行增添 /usr/local/lib然后是跟改变量sudo gedit /etc/bash.bashrc也是在最后一行添加 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH

ubuntu 11.04 下安装 opencv 2.3问题,求解决

libgstreamer中要用到LIBXML2库中的这些函数,但它找不到就出现了“undefined reference to `*********@LIBXML2_2.4.30’ ”,把libxml2库装上再make试试,应该可以通过了。

ubuntu 编译opencv2 安装在什么地方

下载opencv源码,解压后进入目录,执行(注意有个“.”,作为cmake的参数表示当前目录)cmake .然后makesudo make install下面配置library,打开/etc/ld.so.conf.d/opencv.conf,在末尾加入/usr/local/lib (有可能是个空文件,没关系)然后 sudo ldconfig然后/etc/bash.bashrc加入PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfigexport PKG_CONFIG_PATH至此,opencv安装配置完毕

我再ubuntu下安装OpenCV是编译的时候没有提示错误,但是在运行程序的时候提示:

简单的解释就是你的GTK+2.x要先于OpenCV安装,所以它给的解决方法是You should remove the current installation of opencv from your system; rebuild your opencv lib after installing gtk dev lib in the correct path; and reinstall the compiled opencv lib.

ubuntu14.04能装opencv2.3.1吗

整个项目的结构图:编写DetectFaceDemo.java,代码如下: view plaincopyprint?package com.njupt.zhb.test; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.highgui.Highgui; import org.opencv.objdetect.CascadeClassifier; // // Detects faces in an image, draws boxes around them, and writes the results // to "faceDetection.png". // public class DetectFaceDemo { public void run() { System.out.println("\nRunning DetectFaceDemo"); System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath()); // Create a face detector from the cascade file in the resources // directory. //CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath()); //Mat image = Highgui.imread(getClass().getResource("lena.png").getPath()); //注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误 /* * Detected 0 faces Writing faceDetection.png libpng warning: Image * width is zero in IHDR libpng warning: Image height is zero in IHDR * libpng error: Invalid IHDR data */ //因此,我们将第一个字符去掉 String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1); CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath); Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1)); // Detect faces in the image. // MatOfRect is a special container class for Rect. MatOfRect faceDetections = new MatOfRect(); faceDetector.detectMultiScale(image, faceDetections); System.out.println(String.format("Detected %s faces", faceDetections.toArray().length)); // Draw a bounding box around each face. for (Rect rect : faceDetections.toArray()) { Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0)); } // Save the visualized detection. String filename = "faceDetection.png"; System.out.println(String.format("Writing %s", filename)); Highgui.imwrite(filename, image); } } package com.njupt.zhb.test;import org.opencv.core.Core;import org.opencv.core.Mat;import org.opencv.core.MatOfRect;import org.opencv.core.Point;import org.opencv.core.Rect;import org.opencv.core.Scalar;import org.opencv.highgui.Highgui;import org.opencv.objdetect.CascadeClassifier;//// Detects faces in an image, draws boxes around them, and writes the results// to "faceDetection.png".//public class DetectFaceDemo { public void run() { System.out.println("\nRunning DetectFaceDemo"); System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath()); // Create a face detector from the cascade file in the resources // directory. //CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath()); //Mat image = Highgui.imread(getClass().getResource("lena.png").getPath()); //注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误/** Detected 0 faces Writing faceDetection.png libpng warning: Image* width is zero in IHDR libpng warning: Image height is zero in IHDR* libpng error: Invalid IHDR data*/ //因此,我们将第一个字符去掉 String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1); CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath); Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1)); // Detect faces in the image. // MatOfRect is a special container class for Rect. MatOfRect faceDetections = new MatOfRect(); faceDetector.detectMultiScale(image, faceDetections); System.out.println(String.format("Detected %s faces", faceDetections.toArray().length)); // Draw a bounding box around each face. for (Rect rect : faceDetections.toArray()) { Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0)); } // Save the visualized detection. String filename = "faceDetection.png"; System.out.println(String.format("Writing %s", filename)); Highgui.imwrite(filename, image); }}3.编写测试类: view plaincopyprint?package com.njupt.zhb.test; public class TestMain { public static void main(String args) { System.out.println("Hello, OpenCV"); // Load the native library. System.loadLibrary("opencv_java246"); new DetectFaceDemo().run(); } } //运行结果: //Hello, OpenCV // //Running DetectFaceDemo ///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml //Detected 8 faces //Writing faceDetection.png package com.njupt.zhb.test;public class TestMain { public static void main(String args) { System.out.println("Hello, OpenCV"); // Load the native library. System.loadLibrary("opencv_java246"); new DetectFaceDemo().run(); }}//运行结果://Hello, OpenCV////Running DetectFaceDemo///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml//Detected 8 faces//Writing faceDetection.png

ubuntu 11.10下安装openCV失败,求助

1、opencv2.2编译不成功问题:***隐藏网址*** view plain copyusing std::ptrdiff_t; 2、No accelerated colorspace conversion found from yuv422p to bgr24这是在显示视频的时候(一般是avi格式)可能出现的问题,解决办法是要安装x264和libvpx(别执行,先看下面) view plain copysudo apt-get update sudo apt-get install build-essential checkinstall git libfaac-dev libjack-jackd2-dev \ libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev \ libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev texi2html yasm zlib1g-dev view plain copycd git clone git://git.videolan.org/x264 cd x264 ./configure --enable-static make sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \ awk -F’’ ’/POINT/{print $4"+git"$5}’)" --backup=no --deldoc=yes \ --fstrans=no --default view plain copysudo apt-get remove libvpx-dev cd ***隐藏网址***cd libvpx ./configure make sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no \ --deldoc=yes --fstrans=no --default 根据自己的测试,其实不用安装上面的东西就可以,单纯的安装ffmpeg就可以来。 view plain copycd ~ ***隐藏网址***tar -xvzf ffmpeg-0.7-rc1.tar.gz cd ffmpeg-0.7-rc1 ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libxvid --enable-x11grab --enable-swscale --enable-shared make sudo make install 3、Qt下的opencv2.2环境配置配置opencv文件:sudo gedit /etc/ld.so.conf.d/opencv.conf添加如下内容/usr/local/lib启用配置sudo ldconfig再打开另一个配置文件sudo gedit /etc/bash.bashrc在其最后添加:PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfigexport PKG_CONFIG_PATH拷贝库:sudo cp /usr/local/lib/python2.7/site-packages/cv.so /usr/local/lib/python2.7/dist-packages/cv.so可以直接在pro文件下添加包含路径以及库的路径,不用修改配置文件。

怎么验证 ubuntu系统装了opencv

1)查询OpenCV相关软件包$ apt-cache search opencvlibcv-dev - development files for libcvlibcv0.9.7-0 - computer vision librarylibcvaux-dev - development files for libcvauxlibcvaux0.9.7-0 - computer vision extension librarylibhighgui-dev - development files for libhighguilibhighgui0.9.7-0 - computer vision GUI libraryopencv-doc - OpenCV documentation and examplespython-opencv - Python bindings for the computer vision librarypython2.3-opencv - Python bindings for the computer vision library在这里,OpenCV的库CxCore和Cv都被包含入Deb包libcv中。2)安装相关软件包(适用于Debian&Ubuntu)如果只是用来运行OpenCV程序,仅需安装libcvX.Y.Z-N,libcvauxX.Y.Z-N,libhighguiX.Y.Z-N。在本安装例子中是:apt-get install libcv0.9.7-0 libcvaux0.9.7-0 libhighgui0.9.7-0如果你要使用OpenCV来编写程序,那么还需要安装libcv-dev,libcvaux-dev,libhighgui-dev包。apt-get install libcv-dev libcvaux-dev libhighgui-dev文档在opencv-doc包中,python-opencv和python2.3-opencv是OpenCV的Python语言包,可根据需要安装。3)解决无法打开视频文件问题获取ffmpeg,不装这个OpenCV打不开很多视频文件格式或直接安装发行版提供的包libavcodec-dev libavformat-dev之类的。他们是ffmpeg提供的dev包,需要的就是这些。$sudo apt-get install ffmpegffmpeg的编译(我用apt-get install直接安装的,没这样编译)$./configure --enable-libogg --enable-shared --enable-gpl(一定要加上 --enable-shared,不然OpenCV找不到ffmpeg库)***隐藏网址***4)源码编译安装此文档适用于一般的Linux发行版。4.1下载源码***隐藏网址***4.2解压文件$tar zxvf opencv-1.0.0.tar.gz$cd opencv-1.0.04.3检查软件配置$./configurechecking build system type... i686-pc-linux-gnuchecking host system type... i686-pc-linux-gnuchecking target system type... i686-pc-linux-gnuchecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yes... ..Configuration:Compiler: g++CXXFLAGS: -Wall -fno-rtti -pipe -O3 -DNDEBUG -g -march=i686 -ffast-math -fomit-frame-pointerInstall path: /usr/localUse gtk+ 2.x: yesUse libjpeg: yesUse zlib: yesUse libpng: yesUse libtiff: yesUse ffmpeg: yesUse dc1394 & raw1394: yesUse v4l: yesBuild wrappers for- Python noSWIG is at No swig detected. Use existing files.Build demo apps noNow run make ...如果出现上述输出,表明编译OpenCV所需的软件基本已经安装,可以进行下一步。如果提示有需要的软件未安装,请安装後再运行 ./configure 命令,直到提示"Now run make ..."为止。4.4编译OpenCVmake4.5安装OpenCV用root用户执行$sudo make install4.6更新动态连接库用root用户执行下面的操作添加路径/usr/local/lib到文件/etc/ld.so.conf,然後运行命令:$sudo ldconfig将/usr/local/lib/pkgconfig中的opencv.pc 拷贝到/usr/lib/pkgconfig中,(如果不做这步,根本编译不起)$sudo cp /usr/local/lib/pkgconfig/opencv.pc /usr/lib/pkgconfig 5)编译opencv程序的方法以编译cvtest.c文件为例子(因为highgui中采用了c++,所以一定要用g++编译才可以)A. g++ `pkg-config --cflags opencv` -o cvtest cvtest.c `pkg-config --libs opencv`B. 编译: g++ `pkg-config --cflags opencv` -c cvtest.c 链接: g++ `pkg-config --libs opencv` -o cvtest cvtest.o注意这里的`不是单引号’,是数字1键左边的那个键`

ubuntu14.04安装opencv,在编译的时候总是出错

  用下面的这个命令是可以编译通过的,但有俩个警告  arm-linux-g++ -o opencv_test.o test.c -I /usr/local/include/opencv -L /usr/local/lib -lopencv_core -lopencv_highgui -lpthread -lrt  运行上面的命令之前,要将 opencv2 这个目录复制到 opencv下,这俩个目录都在 /usr/local/include/ 下。  g++ `pkg-config opencv --cflags --libs opencv` -o DisplayImage DisplayImage.cpp -I /usr/local/include/opencv -L /usr/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_gpu -lopencv_ts -lopencv_video -lopencv_objdetect -lopencv_ml -lpthread  我用这个OK的~

关于ubuntu安装opencv,ubuntu怎样安装opencv3.1的介绍到此结束,希望对大家有所帮助。