SlideShare a Scribd company logo
4/8~4/27進度
jc.wu
 OpenCV is released under a BSD license and hence it’s free for both
academic and commercial use. It has C++, C, Python and Java
interfaces and supports Windows, Linux, Mac OS, iOS and Android.
OpenCV was designed for computational efficiency and with a
strong focus on real-time applications. Written in optimized C/C++,
the library can take advantage of multi-core processing. Enabled
with OpenCL, it can take advantage of the hardware acceleration of
the underlying heterogeneous compute platform.
1
$ sudo apt-get update
$ sudo apt-get upgrade -y
2
3
• update :
is used to resynchronize the package index files from their
sources. The indexes of available packages are fetched from the
location(s) specified in /etc/apt/sources.list.
• upgrade :
is used to install the newest versions of all packages
currently installed on the system from the sources enumerated in
/etc/apt/sources.list.
安裝CMAKE
$ sudo apt-get install build-essential cmake pkg-
config
安裝GTK函式庫,可用來編譯OPENCV下的一個模組
(highgui),產生GUI介面
$ sudo apt-get install libgtk2.0-dev
4
安裝影像處理相關套件的library,
讓我們可從I/O裝置讀取一些常見的影像格式檔案,
圖像如jpeg, png, tiff等等…
$ sudo apt-get install libjpeg-dev libtiff5-dev
libjasper-dev libpng12-dev
影像:
$ sudo apt-get install libavcodec-dev libavformat-
dev libswscale-dev libv4l-dev$ sudo apt-get install
libxvidcore-dev libx264-dev
5
安裝libatlas-base-dev, gfortran
$ sudo apt-get install libatlas-base-dev gfortran
安裝python的標頭檔
$ sudo apt-get install python2.7-dev python3-dev
安裝python的套件管理程式:pip
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py
6
從github下載opencv和opencv_contrib到系統主目錄並解壓縮
$ cd ~
$ wget -O opencv.zip
https://github.com/Itseez/opencv/archive/3.2.0.zip
$ unzip opencv.zip
7
$ wget -O opencv_contrib.zip
https://github.com/Itseez/opencv_contrib/archive/3.2.0.zip
$ unzip opencv_contrib.zip
注意: opencv和opencv_contrib的檔案版本要一致
8
$ sudo pip install virtualenv virtualenvwrapper
$ sudo rm -rf ~/.cache/pip
9
用nano(一種文字編輯器)開啟profile
$ nano ~/.profile
在profile的最下方加入以下設定參數並存檔,
以使用virtualenv、virtualenvwrapper
# virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
更新profile
$ source ~/.profile 10
$ mkvirtualenv cv -p python3
(可以用python2 or 3)
這個指令只要執行一次就好
再更新一次profile,並使用workon來進入虛擬環境
$ source ~/.profile
$ workon cv
11
安裝Numpy
$ pip install numpy
12
首先確認是否有在virtualenv環境中,如果沒有則執行
$ source ~/.profile
$ workon cv
使用Cmake來編譯opencv
$ cd ~/opencv-3.2.0/
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE 
-D CMAKE_INSTALL_PREFIX=/usr/local 
-D INSTALL_PYTHON_EXAMPLES=ON 
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib- 3.2.0/modules

-D BUILD_EXAMPLES=ON .. 13
14
Compile opencv (約需一小時)
$ make –j4
15
完成compile後,安裝opencv
$ sudo make install
$ sudo ldconfig
查看opencv和python是否安裝成功
$ ls -l /usr/local/lib/python3.4/site-packages/
更改cv2.cpython-34m.so檔名成cv2.so
$ cd /usr/local/lib/python3.4/site-packages/
$ sudo mv cv2.cpython-34m.so cv2.so
將更名後的檔案重新連結(Symbolic link)
$ cd ~/.virtualenvs/cv/lib/python3.4/site-packages/
$ ln -s /usr/local/lib/python3.4/site-packages/cv2.so cv2.so
16
17
$ source ~/.profile
$ workon cv
$ python
>>>import cv2
>>>cv2.__version__
 Raspberry Pi : Raspbian編譯OpenCV原始碼
 Install guide: Raspberry Pi 3 + Raspbian Jessie + OpenCV 3
18

More Related Content

Recently uploaded

一比一原版Otago毕业证成绩单如何办理
一比一原版Otago毕业证成绩单如何办理一比一原版Otago毕业证成绩单如何办理
一比一原版Otago毕业证成绩单如何办理
cnzepoz
 
一比一原版GT毕业证成绩单如何办理
一比一原版GT毕业证成绩单如何办理一比一原版GT毕业证成绩单如何办理
一比一原版GT毕业证成绩单如何办理
cnzepoz
 
一比一原版UofM毕业证成绩单如何办理
一比一原版UofM毕业证成绩单如何办理一比一原版UofM毕业证成绩单如何办理
一比一原版UofM毕业证成绩单如何办理
cnzepoz
 
一比一原版AIS毕业证成绩单如何办理
一比一原版AIS毕业证成绩单如何办理一比一原版AIS毕业证成绩单如何办理
一比一原版AIS毕业证成绩单如何办理
cnzepoz
 
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbbMatrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
joshuaclack73
 
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
kywwoyk
 
一比一原版迪肯大学毕业证成绩单如何办理
一比一原版迪肯大学毕业证成绩单如何办理一比一原版迪肯大学毕业证成绩单如何办理
一比一原版迪肯大学毕业证成绩单如何办理
cnzepoz
 
一比一原版UC Berkeley毕业证成绩单如何办理
一比一原版UC Berkeley毕业证成绩单如何办理一比一原版UC Berkeley毕业证成绩单如何办理
一比一原版UC Berkeley毕业证成绩单如何办理
cnzepoz
 
一比一原版UBC毕业证成绩单如何办理
一比一原版UBC毕业证成绩单如何办理一比一原版UBC毕业证成绩单如何办理
一比一原版UBC毕业证成绩单如何办理
cnzepoz
 
一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理
cnzepoz
 
一比一原版Southern Cross毕业证成绩单如何办理
一比一原版Southern Cross毕业证成绩单如何办理一比一原版Southern Cross毕业证成绩单如何办理
一比一原版Southern Cross毕业证成绩单如何办理
cnzepoz
 
一比一原版SUT毕业证成绩单如何办理
一比一原版SUT毕业证成绩单如何办理一比一原版SUT毕业证成绩单如何办理
一比一原版SUT毕业证成绩单如何办理
cnzepoz
 
一比一原版ArtEZ毕业证成绩单如何办理
一比一原版ArtEZ毕业证成绩单如何办理一比一原版ArtEZ毕业证成绩单如何办理
一比一原版ArtEZ毕业证成绩单如何办理
cnzepoz
 
一比一原版UW毕业证成绩单如何办理
一比一原版UW毕业证成绩单如何办理一比一原版UW毕业证成绩单如何办理
一比一原版UW毕业证成绩单如何办理
cnzepoz
 
一比一原版UMich毕业证成绩单如何办理
一比一原版UMich毕业证成绩单如何办理一比一原版UMich毕业证成绩单如何办理
一比一原版UMich毕业证成绩单如何办理
cnzepoz
 
1. WIX 2 PowerPoint for Work Experience.pptx
1. WIX 2 PowerPoint for Work Experience.pptx1. WIX 2 PowerPoint for Work Experience.pptx
1. WIX 2 PowerPoint for Work Experience.pptx
louise569794
 

Recently uploaded (20)

一比一原版Otago毕业证成绩单如何办理
一比一原版Otago毕业证成绩单如何办理一比一原版Otago毕业证成绩单如何办理
一比一原版Otago毕业证成绩单如何办理
 
一比一原版GT毕业证成绩单如何办理
一比一原版GT毕业证成绩单如何办理一比一原版GT毕业证成绩单如何办理
一比一原版GT毕业证成绩单如何办理
 
一比一原版UofM毕业证成绩单如何办理
一比一原版UofM毕业证成绩单如何办理一比一原版UofM毕业证成绩单如何办理
一比一原版UofM毕业证成绩单如何办理
 
NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...
NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...
NO1 Pandit Black magic/kala jadu,manpasand shadi in lahore,karachi rawalpindi...
 
一比一原版AIS毕业证成绩单如何办理
一比一原版AIS毕业证成绩单如何办理一比一原版AIS毕业证成绩单如何办理
一比一原版AIS毕业证成绩单如何办理
 
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbbMatrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
Matrix Methods.pptxbbbbbbbbbbbbbbbbbbbbb
 
F5 LTM TROUBLESHOOTING Guide latest.pptx
F5 LTM TROUBLESHOOTING Guide latest.pptxF5 LTM TROUBLESHOOTING Guide latest.pptx
F5 LTM TROUBLESHOOTING Guide latest.pptx
 
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
一比一原版SDSU毕业证圣地亚哥州立大学毕业证成绩单如何办理
 
一比一原版迪肯大学毕业证成绩单如何办理
一比一原版迪肯大学毕业证成绩单如何办理一比一原版迪肯大学毕业证成绩单如何办理
一比一原版迪肯大学毕业证成绩单如何办理
 
一比一原版UC Berkeley毕业证成绩单如何办理
一比一原版UC Berkeley毕业证成绩单如何办理一比一原版UC Berkeley毕业证成绩单如何办理
一比一原版UC Berkeley毕业证成绩单如何办理
 
Memory compiler tutorial – TSMC 40nm technology
Memory compiler tutorial – TSMC 40nm technologyMemory compiler tutorial – TSMC 40nm technology
Memory compiler tutorial – TSMC 40nm technology
 
一比一原版UBC毕业证成绩单如何办理
一比一原版UBC毕业证成绩单如何办理一比一原版UBC毕业证成绩单如何办理
一比一原版UBC毕业证成绩单如何办理
 
一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理
 
一比一原版Southern Cross毕业证成绩单如何办理
一比一原版Southern Cross毕业证成绩单如何办理一比一原版Southern Cross毕业证成绩单如何办理
一比一原版Southern Cross毕业证成绩单如何办理
 
一比一原版SUT毕业证成绩单如何办理
一比一原版SUT毕业证成绩单如何办理一比一原版SUT毕业证成绩单如何办理
一比一原版SUT毕业证成绩单如何办理
 
一比一原版ArtEZ毕业证成绩单如何办理
一比一原版ArtEZ毕业证成绩单如何办理一比一原版ArtEZ毕业证成绩单如何办理
一比一原版ArtEZ毕业证成绩单如何办理
 
一比一原版UW毕业证成绩单如何办理
一比一原版UW毕业证成绩单如何办理一比一原版UW毕业证成绩单如何办理
一比一原版UW毕业证成绩单如何办理
 
China Die Casting Manufacturer & Supplier - Bian Diecast
China Die Casting Manufacturer & Supplier - Bian DiecastChina Die Casting Manufacturer & Supplier - Bian Diecast
China Die Casting Manufacturer & Supplier - Bian Diecast
 
一比一原版UMich毕业证成绩单如何办理
一比一原版UMich毕业证成绩单如何办理一比一原版UMich毕业证成绩单如何办理
一比一原版UMich毕业证成绩单如何办理
 
1. WIX 2 PowerPoint for Work Experience.pptx
1. WIX 2 PowerPoint for Work Experience.pptx1. WIX 2 PowerPoint for Work Experience.pptx
1. WIX 2 PowerPoint for Work Experience.pptx
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
Simplilearn
 

Featured (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

樹莓派-安裝opencv3.2和python3

Editor's Notes

  1. 兩個常用的指令