Ubuntu 18.04安装人工智能图像解决工具OpenCV

作者 : 开心源码 本文共2886个字,预计阅读时间需要8分钟 发布时间: 2022-05-12 共157人阅读

图片.png

python版本安装

$ sudo pip install opencv-python$ sudo pip install opencv-contrib-python

C++安装

安装OpenCV依赖

$ sudo apt-get update$ sudo apt-get upgrade# 开发工具$ sudo apt-get install build-essential cmake unzip pkg-config# 图形库   $ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev# 视频库   $ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev$ sudo apt-get install libxvidcore-dev libx264-dev# GTK$ sudo apt-get install libgtk-3-dev# 其余$ sudo apt-get install libatlas-base-dev gfortran# python头文件$ sudo apt-get install python3-dev

下载

$ cd ~$ wget -O opencv.zip  opencv/opencv/archive/3.4.1.zip $ wget -O opencv_contrib.zip  opencv/opencv_contrib/archive/3.4.1.zip$ unzip opencv.zip$ unzip opencv_contrib.zip

官方安装说明

图片.png

上图的右上角的”OpenCV”旁边可以看到最新的版本号。假如你要用opencv3.4.3,修改 opencv/opencv/archive/3.4.1.zip 为 opencv/opencv/archive/3.4.3.zip 就可。

安装

$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules -DOPENCV_ENABLE_NONFREE=True $ sudo make install$ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH$ sudo ldconfig

2.4.13 ubuntu 14.04

# install dependenciessudo apt-get updatesudo apt-get install -y build-essentialsudo apt-get install -y cmakesudo apt-get install -y libgtk2.0-devsudo apt-get install -y pkg-configsudo apt-get install -y python-numpy python-devsudo apt-get install -y libavcodec-dev libavformat-dev libswscale-devsudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils # download opencv-2.4.13wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.13/opencv-2.4.13.zipunzip opencv-2.4.13.zipcd opencv-2.4.13mkdir releasecd release # compile and installcmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -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 -D BUILD_FAT_JAVA_LIB=ON -D INSTALL_TO_MANGLED_PATHS=ON -D INSTALL_CREATE_DISTRIB=ON -D INSTALL_TESTS=ON -D ENABLE_FAST_MATH=ON -D WITH_IMAGEIO=ON -D BUILD_SHARED_LIBS=OFF -D WITH_GSTREAMER=ON -DBUILD_TIFF=ON ..make all -j8 # 8 coressudo make install

参考资料

  • 探讨qq群144081101 591302926 567351477 钉钉免费群21745728
  • 本文最新版本地址
  • 本文涉及的python测试开发库 谢谢点赞!
  • 本文相关海量书籍下载
  • 本文源码地址
  • How to install OpenCV 3.4.0 on Ubuntu 16.04
  • Ubuntu 18.04: How to install OpenCV
  • opencv github
  • [opencv] 2.4.13 on ubuntu 14.04
  • How to specify new GCC path for CMake

FAQ

  • qmake
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory 处理:sudo apt-get install qt-sdk 参考:https://stackoverflow.com/questions/23703864/cmake-not-working-could-not-exec-qmake

说明
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是摆设,本站源码仅提供给会员学习使用!
7. 如遇到加密压缩包,请使用360解压,如遇到无法解压的请联系管理员
开心源码网 » Ubuntu 18.04安装人工智能图像解决工具OpenCV

发表回复