Install OpenCV 3.4

2022. 8. 27. 21:00

โœ”๏ธopencv 3.4.0 ์„ค์น˜

โš ๏ธ ROS ์„ค์น˜ ์ „์— OpenCV ๋จผ์ € ์„ค์น˜ํ•˜๊ธฐ!

 

1. ์„ค์น˜์—ฌ๋ถ€ ํ™•์ธ

 $ pkg-config --modversion opencv

2. ๊ธฐ์กด ๋ฒ„์ „ ์‚ญ์ œ

$ sudo find / -name "*opencv*" -exec rm -rf {} \;
$ sudo find / -name "*OpenCV*" -exec rm -rf {} \;
$ sudo find / -name "*cv2*" -exec rm -rf {} \;

3. ์—…๋ฐ์ดํŠธ

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

4. ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜

$ sudo apt-get install python2.7-dev python3-dev python-numpy python3-numpy

$ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev v4l-utils 
$ sudo apt-get install libxvidcore-dev libx264-dev libxine2-dev
$ sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
$ sudo apt-get install libgtk-3-dev
$ sudo apt-get install mesa-utils libgl1-mesa-dri libgtkgl2.0-dev libgtkglext1-dev
$ sudo apt-get install libatlas-base-dev gfortran libeigen3-dev

5. opencv ์„ค์น˜

$ mkdir opencv
$ cd opencv
$ wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.0.zip
$ wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.4.0.zip

$ unzip opencv.zip
$ unzip opencv_contrib.zip

$ cd opencv-3.4.0
$ mkdir build
$ cd build

6. opencv ๋นŒ๋“œ

$ 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=OFF \
-D WITH_GTK=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules \
-D WITH_V4L=ON  \
-D WITH_FFMPEG=ON \
-D WITH_XINE=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D PYTHON2_INCLUDE_DIR=/usr/include/python2.7 \
-D PYTHON2_NUMPY_INCLUDE_DIRS=/usr/lib/python2.7/dist-packages/numpy/core/include/ \
-D PYTHON2_PACKAGES_PATH=/usr/lib/python2.7/dist-packages \
-D PYTHON2_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so \
-D PYTHON3_INCLUDE_DIR=/usr/include/python3.6m \
-D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/python3/dist-packages/numpy/core/include/  \
-D PYTHON3_PACKAGES_PATH=/usr/lib/python3/dist-packages \
-D PYTHON3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \
../

check number of cpu
$ cat /proc/cpuinfo | grep processor | wc -l

$ make -j4

7. opencv ์ปดํŒŒ์ผ

$ sudo make install
$ sudo sh -c 'echo '/usr/local/lib' > /etc/ld.so.conf.d/opencv.conf'
$ sudo ldconfig

'๐Ÿข Turtlebot3 > ๐Ÿ’ก Setting' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Jetson Nano Info  (0) 2022.09.20
Install ROS Melodic  (0) 2022.08.27

BELATED ARTICLES

more