[Ubuntu] OpenCV install

gnoeyhad·2022년 6월 20일

Build core modules

Install minimal prerequisites (Ubuntu 18.04 as reference)

$ sudo apt update && sudo apt install -y cmake g++ wget unzip

Download and unpack sources

$ wget -O opencv.zip https://github.com/opencv/opencv/archive/4.x.zip
$ unzip opencv.zip

Create build directory

$ mkdir -p build && cd build


$ cmake ../opencv-4.x


$ cmake --build .

Compile and install

find out the number of CPU cores in your machine

$ nproc

substitute 2 after -j by the output of nproc

$ make -j8 2>&1 | tee build_messages.txt
$ sudo make install
$ sudo ldconfig

If the output of next command is '3.4.0' then it's ok!

$ pkg-config --modversion opencv

개인 공부용

0개의 댓글