How to install openCV in linux

Installation in Linux

These steps have been tested for Ubuntu 10.04 but should work with other distros as well.

Required Packages

  • GCC 4.4.x or later
  • CMake 2.6 or higher
  • Git
  • GTK+2.x or higher, including headers (libgtk2.0-dev)
  • pkg-config
  • Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy)
  • ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev
  • [optional] libtbb2 libtbb-dev
  • [optional] libdc1394 2.x
  • [optional] libjpeg-dev, libpng-dev, libtiff-dev, libjasper-dev, libdc1394-22-dev

The packages can be installed using a terminal and the following commands or by using Synaptic Manager:

[compiler] sudo apt-get install build-essential

[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

Getting OpenCV Source Code

You can use the latest stable OpenCV version available in sourceforge or you can grab the latest snapshot from our Git repository.

Getting the Latest Stable OpenCV Version

Getting the Cutting-edge OpenCV from the Git Repository

Launch Git client and clone OpenCV repository

In Linux it can be achieved with the following command in Terminal:

cd ~/<my_working _directory>

git clone https://github.com/Itseez/opencv.git

Building OpenCV from Source Using CMake, Using the Command Line

  1. Create a temporary directory, which we denote as <cmake_binary_dir>, where you want to put the generated Makefiles, project files as well the object files and output binaries.
  2. Enter the <cmake_binary_dir> and type
  3. cmake [<some optional parameters>] <path to the OpenCV source directory>

    For example

    cd ~/opencv

    mkdir release

    cd release

    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

  4. Enter the created temporary directory (<cmake_binary_dir>) and proceed with:
  5. make
  6. sudo make install

Note

If the size of the created library is a critical issue (like in case of an Android build) you can use the install/strip command to get the smallest size as possible. The stripped version appears to be twice as small. However, we do not recommend using this unless those extra megabytes do really matter.

时间: 2024-11-10 01:26:04

How to install openCV in linux的相关文章

install OpenCV on Linux

arch=$(uname -m) if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then flag=1 else flag=0 fi echo "Installing OpenCV 2.4.2" m

Install opencv on Centos

研究centos 有很长一段时间了,一直没有写过这方面的感觉,今天在看到网友的一篇文章时,结合亲身体会就下面安装opencv的一些步骤与大家共享. CentOS OpenCV已被广泛应用但是也在不断的更新,这里介绍CentOS OpenCV安装设置使用,帮助大家安装更新CentOS OpenCV系统.如何在Linux下編譯CentOS OpenCV? (OS) (Linux) (CentOS) (Image Processing) (C/C++)AbstractCentOS OpenCV是一個C

Install OpenCV in Windows for Python

Here I will tell you how to install OpenCV 2.4x in Windows  for Python 2.7. Pre-requisites ( need to be downloaded ) : Python : Download latest version of Python 2.7 from Python site.Numpy : Download Numpy for Python 2.7 from here.OpenCV 2.4 : Downlo

Install a new Linux Kernel (3.10.56) in Guest OS (Dom U)

These days I want to install a new Linux kernel in Guest Operating System. The original version of Guest OS is 2.6.32, but I need a kernel version 3.10. I have tried several ways and following steps is just one of methods which can work: 1. We should

install opencv 2.4.10 with issue :&quot;nvcc fatal : Unsupported gpu architecture &#39;compute_11&#39;&quot;

issue: nvcc fatal   : Unsupported gpu architecture 'compute_11'CMake Error at cuda_compile_generated_matrix_operations.cu.o.cmake:206 (message):  Error generating/home/smie/Documents/opencv2.4.11/build/modules/core/CMakeFiles/cuda_compile.dir/__/dyna

Install MongoDB on Linux Systems 速记

Download the Latest Release >> curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.4.8.tgz Extract MongoDB From Archive >> tar -zxvf mongodb-linux-x86_64-2.4.8.tgz Optional. Copy MongoDB to Target Directory >> mkdir -p mong

install cx_Oracle on Linux

step 1 : install oracle client library url: http://www.oracle.com/technetwork/topics/linuxsoft-082809.html or search:  instant clients download for Linux x86 download:    instantclient-basic-linux-version.zip   # choose your version !!!! instantclien

opencv和linux的关联

这是一篇关于opencv和linux关联的文章 原文地址:https://www.cnblogs.com/zhchoutai/p/8302224.html

install opencv with python2 in OSX - 在OSX安装基于python2的opencv

基本按照http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/ 安装,除了更改一些自己的目录. 1. 安装xcode 2. 安装 Homebrew - 补充OSX一些包 $ cd ~ $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"$ brew u