- Today
- Total
엔지니어스 - Engineeus
Xavier Opencv Downgrade (4.5.3 -> 4.5.2) 본문
Xavier Opencv Downgrade (4.5.3 -> 4.5.2)
What made me to do it?
: I got serious error when I pree key on opencv window (imshow result).
It always makde 'segmentation (core dumped)' error.
I suspedted this is from Opencv or torch&torchvision error.
So I just reinstalled opencv first.
This is the reason I did this work.
<remove>
sudo apt-get update
sudo apt-get upgrade
built-in opencv is located in '/usr/local/lib/python3.6/dist-packages'
check this.
I couldn't find the build directory so did:
$ sudo apt-get purge '*opencv*'
And:
$ sudo find / -name "*opencv*" -exec rm -rf {} \;
Which seems to have worked fine.
You can double check with:
$ sudo find / -name "*opencv*";
<install dependencies>
$ sudo apt-get install build-essential cmake git unzip pkg-config
$ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev
$ sudo apt-get install libgtk2.0-dev libcanberra-gtk*
$ sudo apt-get install python3-dev python3-numpy python3-pip
$ sudo apt-get install libxvidcore-dev libx264-dev libgtk-3-dev
$ sudo apt-get install libtbb2 libtbb-dev libdc1394-22-dev
$ sudo apt-get install libv4l-dev v4l-utils
$ sudo apt-get install libavresample-dev libvorbis-dev libxine2-dev
$ sudo apt-get install libfaac-dev libmp3lame-dev libtheora-dev
$ sudo apt-get install libopencore-amrnb-dev libopencore-amrwb-dev
$ sudo apt-get install libopenblas-dev libatlas-base-dev libblas-dev
$ sudo apt-get install liblapack-dev libeigen3-dev gfortran
$ sudo apt-get install libhdf5-dev protobuf-compiler
$ sudo apt-get install libprotobuf-dev libgoogle-glog-dev libgflags-dev
<download>
sl@sl-xavier:~/work$ mkdir opencv
sl@sl-xavier:~/work$ cd opencv
sl@sl-xavier:~/work/opencv$ mkdir opencv_4.5.2
sl@sl-xavier:~/work/opencv$
sl@sl-xavier:~/work/opencv$ cd opencv_4.5.2/
Download OpenCV 4.5.2 from Github.
$ cd ~
$ wget -O opencv.zip https://github.com/opencv/opencv/archive/4.5.2.zip
$ wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.5.2.zip
Unzip the folders, rename them and clean up the zipped folders.
$ unzip opencv.zip
$ unzip opencv_contrib.zip
$ mv opencv-4.5.2 opencv
$ mv opencv_contrib-4.5.2 opencv_contrib
$ rm opencv.zip
$ rm opencv_contrib.zip
<cmake>
Build OpenCV
Create the building directory.
$ cd ~/opencv
$ mkdir build
$ cd build
Configure CMake to build OpenCV the way you want it. These flags can be changed to adapt the installation to your needs.
* change 'OPENCV_EXTRA_MODULES_PATH'
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr \
-D OPENCV_EXTRA_MODULES_PATH=/home/'username'/work/opencv/opencv_4.5.2/opencv_contrib/modules \
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \
-D WITH_OPENCL=OFF \
-D WITH_CUDA=ON \
-D CUDA_ARCH_BIN=7.2 \
-D CUDA_ARCH_PTX="" \
-D WITH_CUDNN=ON \
-D WITH_CUBLAS=ON \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D OPENCV_DNN_CUDA=ON \
-D ENABLE_NEON=ON \
-D WITH_QT=OFF \
-D WITH_OPENMP=ON \
-D WITH_OPENGL=ON \
-D BUILD_TIFF=ON \
-D WITH_FFMPEG=ON \
-D WITH_GSTREAMER=ON \
-D WITH_TBB=ON \
-D BUILD_TBB=ON \
-D BUILD_TESTS=OFF \
-D WITH_EIGEN=ON \
-D WITH_V4L=ON \
-D WITH_LIBV4L=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D BUILD_opencv_python3=TRUE \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D CMAKE_C_COMPILER=/usr/bin/gcc-7 \
-D BUILD_EXAMPLES=OFF ..
If the configuration went well, you should see a report and a message that the configuration is done. You are now ready to build OpenCV.
$ make -j6
This step will take one to two hours and might sometimes look frozen. Do not stop the process before the build is 100% completed and you see the prompt back. Now you can install the libraries that you just built and remove the build folders.
$ sudo make install
$ sudo ldconfig
$ make clean
$ sudo rm -rf ~/opencv
$ sudo rm -rf ~/opencv_contrib
You should now have OpenCV 4.5.2 installed on you companion computer. To test that your installation, you can use Python.
<test>
$ python3
>>>import cv2
>>>cv2.__version__
>>>exit()
'NVIDIA > XAVIER AGX' 카테고리의 다른 글
Jetson FAN / 성능(MAX) 변경 (0) | 2022.06.30 |
---|---|
NVIDIA XAVIER AGX/NX에 OpenPose 설치하기 (초 간단) / Jetpack 4.4 기준 (0) | 2021.07.23 |
NVIDIA XAVIER (AGX) 보드 세팅 [3] - 추가 SSD로 홈디렉토리 옮기기 (초간단) (1) | 2021.07.22 |
NVIDIA XAVIER (AGX) 보드 세팅 [2] - Jetpack 으로 한방에 설치 (NVIDIA Xavier 공장 초기화도 가능!) (0) | 2021.07.21 |
NVIDIA XAVIER AGX/NX에 OpenPose 설치하기 (초 간단) / Jetpack 4.5 버전 (0) | 2021.07.14 |