Ubuntu install compile OpenCV one-click Script (with FFmpeg)

Source: Internet
Author: User

1. Switch to the user folder

CD ~

2. Create a new file. Name the opencv.sh script for example the following:

Version= "$ (wget-q-o-http://sourceforge.net/projects/opencvlibrary/files/opencv-unix | egrep-m1-o ' \" [0-9] (\.[ 0-9]) + ' | cut-c2-) "echo" Installing OpenCV "$versionmkdir opencvcd opencvecho" Removing any pre-installed ffmpeg and x264 "
sudo apt-get install unzip
sudo apt-get install cmakesudo apt-get-qq Remove ffmpeg x264 libx264-devecho "Installing Dependenices" sudo apt-get-qq in Stall 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 libfaac-dev Libmp3lame-dev Libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils Ffmpegecho " Downloading OpenCV "$versionwget-o opencv-$version. zip http://sourceforge.net/projects/opencvlibrary/files/ opencv-unix/$version/opencv-"$version". Zip/downloadecho "Installing OpenCV" $versionunzip opencv-$version. zipcd opencv-$versionmkdir buildcd buildcmake-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. Make-j2sudo checkinstallsudo sh-c ' echo '/usr/local/lib ' >/etc/ld.so.conf.d/opencv.conf ' sudo ldconfigecho ' OpenCV ' $version "ready to be used"

3. Change to Executable

chmod +x opencv.sh

4. Implementation

./opencv.sh


Note: Assume that there are no Java-related jar and. So files in Lib and bin after compiling. You need to install the JDK and export the Java_home variable: for example, 64-bit Ubuntu,

 Java_home  =  /usr/  Lib  /  JVM  /  -  -  OpenJDK  -  AMD64  

(path differ in your system), CMake generated both:

/  Bin  /  OpenCV  - 249.jar  build  / lib   / libopencv_java249  . so  

Ubuntu install compile OpenCV one-click Script (with FFmpeg)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.