2016年4月25日 星期一

OpenCV Install

先說結論:

Step 1: Use VMware to install Ubuntu 14.04.4 (TLS) version.

Step 2: Install anaconda2  (OpenCV2.x and 3.1.x 似乎和 python 2.7 相容,如果 python 3.x 會遇到相容問題)

Step 3: Use conda install -c https://conda.binstar.org/menpo opencv=3.1.0 

如果要重新 compile and cmake opencv.  我尚未成功。

--> another problem is ffmpeg doesn't seem to work using conda install

-> so all video using VideoCapture not working!!!

-> it seems that need to include opencv_contribute

 

-------------------------------------------------------

 

1. Need to install anaconda2; reinstall from contiumm

2. Need to run face detection

 

sudo apt-get install libgtk2.0-dev

sudo apt-get install pkg-config

 

More complete installation guide of opencv, please follow:

 

http://ccw1986.blogspot.tw/2013/09/learningopencv.html

OpenCV Tutorial

 

http://ccw1986.blogspot.tw/2016/03/install-python-and-opencv-31-on-ubuntu.html

Installation of OpenCV on Ubuntu TLS14.04

 

It works on c++ version, but failed on the anaconda python.

 

Update latest packages and installed

$ sudo apt-get update
$ sudo apt-get upgrade

apt-get update - 更新最新的套件資訊 apt-get upgrade - 更新套件

安裝基本開發工具

$ sudo apt-get install build-essential cmake pkg-config git
  • build-essential - 基本編譯器
  • git - 分散式的版本控制系統
  • cmake - 跨平台自動化建構系統
  • pkg-config - 查詢套件include與library的位置

安裝影像I/O開發工具,例:JPEG, PNG, TIFF, etc.

$ sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev

安裝影音I/O開發工具,讀影影片、接收串流、影音解碼...

$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev

安裝GTK開發工具,OpenCV highgui module顯示視窗時需要

$ sudo apt-get install libgtk2.0-dev
  • libgtk2.0-dev - (Gimp ToolKit)跨平台的圖形介面開發套件
$ sudo apt-get install libtbb-dev
  • libtbb-dev - (Intel® Threading Building Blocks )平行計算引擎

安裝OpenCV優化的開發工具

$ sudo apt-get install libatlas-base-dev gfortran

以下 install python 部份 ignore.  因為要改用 anaconda2

http://dr-kayai.hatenablog.com/entry/2015/03/30/134856

 

 

So I remove the anaconda2 directory and re-build the opencv!!

 

NOT WORKING!!!!! for python ==> import cv2 has problem.

 

最後找到直接可用 anaconda install opencv3 方法

http://danwin.com/2014/12/compile-opencv-2-4-10-ubuntu-14-04-14-10/

不過以上是 opencv2, 必須修改

 

  1. conda install binstar 
  2. 似乎 binstar 改為 anaconda-client  -> conda install anaconda-client 做一次
  3. conda install -c https://conda.binstar.org/menpo opencv=3.1.0  (可以直接到 url 找最新的 opencv)
It works!!!!
不過 opencv3 和 opencv2 有些地方不同, example face detection
opencv2 --> cv2.cv.CV_HAAR_SCALE_IMAGE
opencv3 --> cv2.CASCADE_SCALE_IMAGE

 

 

 

沒有留言:

張貼留言

追蹤者