CUDA를 지원하는 경우 CUDA설치하기 항목을 참조하여 설치
~~https://gist.github.com/raulqf/f42c718a658cddc16f9df07ecc627be7 참조~~
https://velog.io/@minukiki/Ubuntu-20.04에-OpenCV-4.4.0-설치 참조
https://www.sproutworkshop.com/2021/04/how-to-compile-opencv-4-5-2-with-cuda-11-2-and-cudnn-8-1-on-ubuntu-20-04/ 참조
다음을 입력하여 opencv 설치 여부 확인
$ pkg-config --modversion opencv
$ sudo apt-get install -y build-essential cmake
$ sudo apt-get install -y libopenexr-dev
$ sudo apt-get install -y libjpeg-dev libtiff5-dev libpng-dev
$ sudo apt-get install -y libv4l-dev v4l-utils
$ sudo apt-get install -y ffmpeg libavcodec-dev libavformat-dev libswscale-dev libxvidcore-dev libx264-dev libxine2-dev
$ sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
$ sudo apt-get install -y libgtk-3-dev
$ sudo apt-get install -y mesa-utils libgl1-mesa-dri libgtkgl2.0-dev libgtkglext1-dev
$ sudo apt-get install -y libatlas-base-dev gfortran libeigen3-dev
$ sudo apt-get install -y python3-dev python3-numpy
$ sudo apt install -y liblept5 leptonica-progs libleptonica-dev libtesseract-dev
$ sudo apt install -y libgflags-dev
$ mkdir opencv
$ cd opencv
# for 4.5.5
$ wget -O opencv.zip <https://github.com/opencv/opencv/archive/4.5.5.zip>
# for 4.8.0
$ wget -O opencv.zip <https://github.com/opencv/opencv/archive/4.8.0.zip>
$ unzip opencv.zip
$ wget -O opencv_contrib.zip [<https://github.com/opencv/opencv_contrib/archive/4.5.5.zip>](<https://github.com/opencv/opencv_contrib/archive/4.4.0.zip>)
$ wget -O opencv_contrib.zip [<https://github.com/opencv/opencv_contrib/archive/4.8.0.zip>](<https://github.com/opencv/opencv_contrib/archive/4.4.0.zip>)
$ unzip opencv_contrib.zip