Auto install opencv after installing Ubuntu
Here is the shell code#!/bin/bashsudo apt-get install -y build-essentialsudo apt-get install -y cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-devsudo apt-get instal
Here is the shell code
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
How to do
- step1: copy this into a file named installOpencv.sh
- step2:
- 1
- 1
- step3:
- 1
- 2
- 1
- 2
-
step4: check your file directory, it should be like this:
—–installOpencv.sh
—–OpenCV
—–opencv_contrib -
step5: edit installOpencv.sh, change OPENCV_EXTRA_MODULES_PATH to your own.
-
step6: ./installOpencv.sh
You may need to input password when sudo make install, because compiling opencv costs much time.
You may notice that there is a test demo for opencv. It is simple test of using opencv to show an image. After installation, this test demo will be deleted.
Version 2
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
In this shell, you still need to change OPENCV_EXTRA_MODULES_PATH to your own. It will Git clone opencv src automatically.
Problem
- “Unable to fetch http://….” You need to change your apt source in /etc/apt/sources.list. Different version of ubuntu uses different nickname, and the others are the same. For 16.04, it is xenial. Without essential packages correctly installed, it will get error when compiling opencv. It is important.
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)