Open CV 3.4.5 ์ค์น
OS: Ubuntu 18.04 Focal Package: OpenCV 3.4.5
1. ๋ฏธ๋ฆฌ ์ค์น๋ OpenCV ๋ฒ์ ์ญ์
๋๋ฒ์งธ ๋ช
๋ น์ด ์คํ์ ๊ด๋ จ๋ ๋ค๋ฅธ ํจํค์ง๋์ํฅ์ ๋ฐ์ ์ ์์
i.e. nvidia graphic driver
$ sudo apt purge libopencv* python3-opencv
$ sudo apt autoremove -y
2. ๋ถ๊ฐ ํจํค์ง ์ค์น
๋ธ๋ก๊ทธ ์ฐธ์กฐ: https://wth-mongdol.tistory.com/m/223
# ๋น๋, ์์ค ๊ด๋ จ
$ sudo apt install -y build-essential cmake pkg-config git
# ์ด๋ฏธ์ง ๊ด๋ จ
$ sudo apt install -y libjpeg-dev libtiff5-dev libpng-dev libjasper-dev
# ๋์์ ๋ฐ ์นด๋ฉ๋ผ ๊ด๋ จ
$ sudo apt install -y libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxvidcore-dev libx264-dev libxine2-dev libv4l-dev v4l-utils libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
# GUI, qt, ์ต์ ํ, python3 ๊ด๋ จ
$ sudo apt install -y libgtk-3-dev libatlas-base-dev libeigen3-dev gfortran
$ sudo apt install -y python3-dev python3-numpy libtbb2 libtbb-dev
3. OpenCV 3.4.5 ์ค์น
opencv-x.x.x: ๊ธฐ๋ณธ ์์ค ์ฝ๋
opencv_contrib-x.x.x: ์ถ๊ฐ ๊ธฐ๋ฅ ์ฝ๋(Extra Module, ์๊ณ ๋ฆฌ์ฆ, ํ ์คํธ ์ค์ธ ์ ๊ธฐ๋ฅ ํฌํจ)
$ wget -O opencv-3.4.5.zip https://github.com/opencv/opencv/archive/3.4.5.zip
$ wget -O opencv_contrib-3.4.5.zip https://github.com/opencv/opencv_contrib/archive/3.4.5.zip
์์ถ ํ๊ธฐ
$ unzip opencv-3.4.5.zip
$ unzip opencv_contrib-3.4.5.zip
๋น๋ ์ค๋น
$ cd opencv-3.4.5
$ mkdir build
$ cd build
๋น๋
$ cmake \ -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D WITH_TBB=OFF \ -D WITH_IPP=OFF \ -D WITH_1394=OFF \ -D BUILD_WITH_DEBUG_INFO=OFF \ -D BUILD_DOCS=OFF \ -D INSTALL_C_EXAMPLES=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D BUILD_EXAMPLES=OFF \ -D BUILD_TESTS=OFF \ -D BUILD_PERF_TESTS=OFF \ -D WITH_QT=ON \ -D WITH_GTK=OFF \ -D WITH_OPENGL=ON \ -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.5/modules \ -D WITH_V4L=ON \ -D WITH_FFMPEG=ON \ -D WITH_XINE=ON \ -D BUILD_NEW_PYTHON_SUPPORT=ON \ -D OPENCV_GENERATE_PKGCONFIG=ON ../
make
# ์ฝ์ด ๊ฐ์ ํ์ธ
$ nproc
$ make -j16
# ์ด์ ์ค์น๋ฅผ ํด์ค๋๋ค.
$ sudo make install
3. ๋ฒ์ ํ์ธ
$ pkg-config --modversion opencv
Leave a comment