Install the OpenCV with versions of Python 2/3 and C++ on Ubuntu 18.04
# Update the package lists
sudo apt update -y
# Install required packages
sudo apt install -y pkg-config python-dev python-numpy python-scipy python-setuptools python-pip
sudo apt install python-opencv -y
$ python
Python 2.7.17 (default, Mar 18 2022, 13:21:42)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.5.0'
sudo apt install python3-opencv -y
$ python3
Python 3.6.9 (default, Mar 15 2022, 13:55:28)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.6.0'
sudo apt install libopencv-dev -y
$ pkg-config --modversion opencv
3.2.0
sudo apt-get install -y cmake git libgtk2.0-dev pkg-config mlocate \
libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev \
libpng-dev libtiff-dev libjasper1 libjasper-dev libdc1394-22-dev build-essential
# Go to $HOME folder
cd ~
# 4.6.0 was released on June 12, 2022
wget -O opencv.zip https://github.com/opencv/opencv/archive/4.6.0.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.6.0.zip
# Unzip the folder of sources
unzip opencv.zip
unzip opencv_contrib.zip
# Do operations for working folders
mv opencv-4.5.0 opencv
mv opencv_contrib-4.5.0 opencv_contrib
mv opencv_contrib opencv
cd ~/opencv && mkdir build && cd build
It will take long time to build all, but you can speed it up by {-jN}: N is as twice as the number of kernels of your CPU.
cmake ..
sudo make -j8
sudo make install
cd ~
rm opencv.zip opencv_contrib.zip
sudo touch /etc/ld.so.conf.d/opencv.conf
sudo echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf
sudo ldconfig
sudo echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" >> /etc/bash.bashrc
sudo echo "export PKG_CONFIG_PATH" >> /etc/bash.bashrc
source /etc/bash.bashrc
sudo updatedb -y
sudo reboot
echo "export OPENCV_SAMPLES_DATA_PATH=~/opencv/samples/data" >> ~/.bashrc
source ~/.bashrc
sudo apt-get install ubuntu-restricted-extras
sudo apt-get install libavcodec54 libav-tools ffmpeg
Qt Creator Installation on Ubuntu 18.04 The following scripts can be written to a bash file named "qtcreator_install.sh". YELLOW="\e[1;33m" ENDCOLOR="\e[m" echo -e "${YELLOW}[Begin to install Qt Creator 4.5.2 & Qt 5.9.5]${ENDCOLOR}" echo -e "${YELLOW}[Update the package lists]${ENDCOLOR}"
Jul 19, 2022VS Code Installation on Ubuntu 18.04 The following scripts can be written to a bash file named "vscode_install.sh". YELLOW="\e[1;33m" ENDCOLOR="\e[m" echo -e "${YELLOW}[Begin to install VS CODE]${ENDCOLOR}" echo -e "${YELLOW}[Add key and source list of vscode to apt]${ENDCOLOR}"
Jul 19, 2022OpenCV introduction Reference https://opencv.org/releases/ https://docs.opencv.org/4.6.0/ Environment Setup https://hackmd.io/4TXk4tknSMmlW77bZCzZtA#Additional-Environment-Setup-If-Required
Jun 28, 2022Item Detail Remark 格式 首要任務:下載研討會或期刊規定格式。 雖說萬事起頭難,但這步驟一點都不難,就跟使用計算機前先按下開關一樣簡單。 流水號 章節、圖、表、方程式、參考文獻 。
Jun 28, 2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up