반응형




OpenCV 4.0.1과 opencv_contrib(extra modules)를 컴파일하여 Ubuntu 16.04에 설치하는 방법을 다룹니다.


ps. Ubuntu 18.04에 OpenCV를 설치하는 방법은 다음 포스트를 참고하세요


Ubuntu 18.04에 OpenCV 4.2.0 설치하는 방법

https://webnautes.tistory.com/1186 





1. 설치된 OpenCV 제거


2. 기존 설치된 패키지 업그레이드


3. OpenCV 컴파일 전 필요한 패키지 설치


4. OpenCV 설정과 컴파일 및 설치


5. OpenCV 설치 결과 확인

    5.1. C/C++

    5.2. Python




최종작성 2020. 06. 01


Python에서 사용할 OpenCV만 설치하는 경우에는 다음 명령으로 설치할 수 있습니다. 

OpenCV의 nonfree 모듈을 사용해야 할 경우에는 컴파일을 해야 합니다.  


pip3 install opencv-contrib-python



1. 설치된 OpenCV 제거 

전에 설치했던 OpenCV가 있다면 새로 설치하는 OpenCV 4.0.1 버전이 제대로 동작하지 않기 때문에 제거해주어야 합니다.


아래처럼 보이면 OpenCV가 설치안되어 있는 상태입니다. 다음 단계로 넘어가도  됩니다.


webnautes@webnautes-pc:~$ pkg-config --modversion opencv
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found




OpenCV 2.4대 버전이 설치되어 있는 경우에는 OpenCV  2.4 버전이 출력됩니다.


webnautes@webnautes-pc:~$ pkg-config --modversion opencv
2.4.9.1



다음 명령으로 OpenCV 라이브러리 설정 파일을 포함해서 기존에 설치된 OpenCV 패키지를 삭제하고 진행해야 합니다. 


$ sudo apt-get purge  libopencv* python-opencv
$ sudo apt-get autoremove



2. 기존 설치된 패키지 업그레이드

OpenCV 4.0.1를 설치해주기 전에 기존에 설치된 패키지들을 업그레이드 해주기 위한 작업입니다. 

오래 걸리더라도 해주는 것이 좋습니다. 



Ubuntu 저장소(repository)로부터 패키지 리스트를 업데이트합니다.

기존에 설치된 패키지들의 새로운 버전이 저장소에 있다면 리스트를 업데이트 하기위해 실행합니다. 


$ sudo apt-get update



기존에 설치된 패키지의 새로운 버전이 있으면 업그레이드를 진행합니다.


$ sudo apt-get upgrade




3. OpenCV 컴파일 전 필요한 패키지 설치


OpenCV를 컴파일하는데 사용하는 것들이 포함된 패키지들을 설치합니다.

 

build-essential 패키지에는 C/C++ 컴파일러와 관련 라이브러리, make 같은 도구들이 포함되어 있습니다.

cmake는 컴파일 옵션이나 빌드된 라이브러리에 포함시킬 OpenCV 모듈 설정등을 위해 필요합니다.

 

$ sudo apt-get install build-essential cmake

 

 

 

pkg-config는 프로그램 컴파일 및 링크시 필요한 라이브러리에 대한 정보를 메타파일(확장자가 .pc 인 파일)로부터 가져오는데 사용됩니다.

터미널에서 특정 라이브러리를 사용한 소스코드를 컴파일시 필요한 컴파일러 및 링커 플래그를 추가하는데 도움이 됩니다.  

 

$ sudo apt-get install pkg-config

 

 

 

특정 포맷의 이미지 파일을 불러오거나 기록하기 위해 필요한 패키지들입니다.

 

$ sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev

 

 

 

특정 코덱의 비디오 파일을 읽어오거나 기록하기 위해 필요한 패키지들입니다.

 

$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libxvidcore-dev libx264-dev libxine2-dev

 

 

 

Video4Linux 패키지는 리눅스에서 실시간 비디오 캡처를 지원하기 위한 디바이스 드라이버와 API를 포함하고 있습니다.

 

$ sudo apt-get install libv4l-dev v4l-utils

 

 

 

GStreamer는 비디오 스트리밍을 위한 라이브러리입니다.

$ sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

 

 

 

OpenCV에서는 highgui 모듈을 사용하여 자체적으로 윈도우 생성하여 이미지나 비디오들을 보여줄 수 있습니다.

윈도우 생성 등의 GUI를 위해 gtk 또는 qt를 선택해서 사용가능합니다.  

여기서는 qt4를 지정해주었습니다. QImage와 Mat 간의 변환에는 영향을 주지 않습니다.

 

$ sudo apt-get install libqt4-dev

 

 

 

OpenGL 지원하기 위해 필요한 라이브러리입니다.

$ sudo apt-get install mesa-utils libgl1-mesa-dri libqt4-opengl-dev

 

 

 

OpenCV 최적화를 위해 사용되는 라이브러리들입니다.

$ sudo apt-get install libatlas-base-dev gfortran libeigen3-dev

 

 

 

python2.7-dev와 python3-dev 패키지는 OpenCV-Python 바인딩을 위해 필요한 패키지들입니다.

Numpy는 매트릭스 연산등을 빠르게 처리할 수 있어서 OpenCV에서 사용됩니다.

 

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

 



4. OpenCV 설정과 컴파일 및 설치


소스 코드를 저장할 임시 디렉토리를 생성하여 이동 후.. 진행합니다.


webnautes@webnautes-pc:~$ mkdir opencv
webnautes@webnautes-pc:~$ cd opencv
webnautes@webnautes-pc:~/opencv




OpenCV 4.0.1 소스코드를 다운로드 받아 압축을 풀어줍니다.

 

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




opencv_contrib(extra modules) 소스코드를 다운로드 받아 압축을 풀어줍니다.

SIFT, SURF 등을 사용하기 위해 필요합니다.


$ wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.0.1.zip
$ unzip opencv_contrib.zip




다음처럼 두 개의 디렉토리가 생성됩니다. 


webnautes@webnautes-pc:~/opencv$ ls -d */
opencv-4.0.1/  opencv_contrib-4.0.1/




opencv-4.0.1 디렉토리로 이동하여 build 디렉토리를 생성하고 build 디렉토리로 이동합니다.

컴파일은 build 디렉토리에서 이루어집니다.


webnautes@webnautes-pc:~/opencv$ cd opencv-4.0.1/
webnautes@webnautes-pc:~/opencv/opencv-4.0.1$ mkdir build
webnautes@webnautes-pc:~/opencv/opencv-4.0.1$ cd build
webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build




cmake를 사용하여 OpenCV 컴파일 설정을 해줍니다. 


OpenCV 4.0.1에서 pkg-config를 디폴트로 지원하지 않는 것으로 바뀌었습니다. 

그래서 OPENCV_GENERATE_PKGCONFIG=ON 옵션을 추가해보았습니다.

( 참고 https://github.com/opencv/opencv/issues/13154


하지만 진행해보니 적용이 되지 않았습니다. 혹시 성공하신 분있으시면 댓글로 알려주세요. 

이 옵션을 사용하니 사용할 수 있네요.  


Non free 모듈을 사용하려면 다음 옵션을 추가하세요.

-D OPENCV_ENABLE_NONFREE=ON  



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-4.0.1/modules \
-D WITH_V4L=ON  \
-D WITH_FFMPEG=ON \
-D WITH_XINE=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON ../




다음과 같은 메시지가 보이면 정상적으로 된 것입니다.


-- Configuring done

-- Generating done

-- Build files have been written to: /home/webnautes/opencv/opencv-4.0.1/build




cmake를 사용하여 진행한 OpenCV 컴파일 관련 설정 결과입니다.


-- General configuration for OpenCV 4.0.1 =====================================
--   Version control:               unknown
--
--   Extra modules:
--     Location (extra):            /home/webnautes/opencv/opencv_contrib-4.0.1/modules
--     Version control (extra):     unknown
--
--   Platform:
--     Timestamp:                   2019-01-17T23:01:16Z
--     Host:                        Linux 4.15.0-29-generic x86_64
--     CMake:                       3.5.1
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
--
--   CPU/HW features:
--     Baseline:                    SSE SSE2 SSE3
--       requested:                 SSE3
--     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
--       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
--       SSE4_1 (5 files):          + SSSE3 SSE4_1
--       SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
--       FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
--       AVX (4 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
--       AVX2 (11 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
--       AVX512_SKX (1 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_SKX
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 5.4.0)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):     
--     Linker flags (Debug):       
--     ccache:                      NO
--     Precompiled headers:         YES
--     Extra dependencies:          dl m pthread rt
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python2 python3 python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java js matlab ovis sfm ts viz
--     Applications:                apps
--     Documentation:               NO
--     Non-free algorithms:         NO
--
--   GUI:
--     GTK+:                        NO
--     OpenGL support:              NO
--     VTK support:                 NO
--
--   Media I/O:
--     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
--     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
--     WEBP:                        build (ver encoder: 0x020e)
--     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54)
--     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.6)
--     JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--     HDR:                         YES
--     SUNRASTER:                   YES
--     PXM:                         YES
--     PFM:                         YES
--
--   Video I/O:
--     FFMPEG:                      YES
--       avcodec:                   YES (ver 56.60.100)
--       avformat:                  YES (ver 56.40.101)
--       avutil:                    YES (ver 54.31.100)
--       swscale:                   YES (ver 3.1.101)
--       avresample:                NO
--     GStreamer:                  
--       base:                      YES (ver 1.8.3)
--       video:                     YES (ver 1.8.3)
--       app:                       YES (ver 1.8.3)
--       riff:                      YES (ver 1.8.3)
--       pbutils:                   YES (ver 1.8.3)
--     v4l/v4l2:                    linux/videodev2.h
--     Xine:                        YES (ver 1.2.6)
--
--   Parallel framework:            pthreads
--
--   Trace:                         YES (with Intel ITT)
--
--   Other third-party libraries:
--     Lapack:                      NO
--     Eigen:                       YES (ver 3.2.92)
--     Custom HAL:                  NO
--     Protobuf:                    build (3.5.1)
--
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/webnautes/opencv/opencv-4.0.1/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.12)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
--     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)
--     install path:                lib/python2.7/dist-packages/cv2/python-2.7
--
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.5.2)
--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)
--     numpy:                       /usr/lib/python3/dist-packages/numpy/core/include (ver 1.11.0)
--     install path:                lib/python3.5/dist-packages/cv2/python-3.5
--
--   Python (for build):            /usr/bin/python2.7
--
--   Java:                         
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Install to:                    /usr/local
-- -----------------------------------------------------------------





다음처럼 Python 2 또는 Python 3 라이브러리 항목이 보이지 않는 경우에는   


--   Python 2:

--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.12)

--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)

--     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.11.0)

--     install path:                lib/python2.7/dist-packages/cv2/python-2.7

-- 

--   Python 3:

--     Interpreter:                 /usr/bin/python3 (ver 3.5.2)

--     Libraries:                   /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)

--     numpy:                       /usr/lib/python3/dist-packages/numpy/core/include (ver 1.11.0)

--     install path:                lib/python3.5/dist-packages/cv2/python-3.5

-- 

--   Python (for build):            /usr/bin/python2.7




붉은색 줄처럼 해당 경로들을 직접 적어줘야 합니다.   포스팅에서 사용한 옵션과 차이가 있을 수 있습니다. 


$ 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-4.0.1/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.5m \

-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.5m.so \

../




컴파일을 시작하기 전에 사용 중인 컴퓨터의 CPU 코어수를 확인합니다.


$ cat /proc/cpuinfo | grep processor | wc -l
4




make 명령을 사용하여 컴파일을 시작합니다. -j 다음에 위에서 확인한 숫자를 붙여서 실행해줍니다.

앞에 time을 붙여서 실행하면 컴파일 완료 후 걸린 시간을 알려줍니다.


webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$ time make -j4



컴파일 성공하면 다음과 같은 메시지를 볼 수 있습니다.


[100%] Built target opencv_stitching

Scanning dependencies of target opencv_python2

Scanning dependencies of target opencv_python3

[100%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o

[100%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o

[100%] Linking CXX shared module ../../lib/cv2.so

[100%] Linking CXX shared module ../../lib/python3/cv2.cpython-36m-x86_64-linux-gnu.so

[100%] Built target opencv_python2

[100%] Built target opencv_python3


real 13m36.700s

user 41m52.880s

sys 1m50.322s

webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build



참고로 i5, SSD, 16G 메모리를 장착한 노트북에서 컴파일한데 걸린 시간은  위 결과에서 user + sys를 더한 약 43분입니다.



이제 컴파일 결과물을 설치합니다.

 

webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$ sudo make install



/etc/ld.so.conf.d/ 디렉토리에 /usr/local/lib를 포함하는 설정파일이 있는지 확인합니다.


webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$ cat /etc/ld.so.conf.d/*
/usr/lib/x86_64-linux-gnu/libfakeroot

# libc default configuration

/usr/local/lib

# Multiarch support

/usr/local/lib/x86_64-linux-gnu

/lib/x86_64-linux-gnu

/usr/lib/x86_64-linux-gnu

# Legacy biarch compatibility support

/lib32

/usr/lib32




/usr/local/lib이 출력되지 않았다면 다음 명령을 추가로 실행해야합니다.


webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$  sudo sh -c 'echo '/usr/local/lib' > /etc/ld.so.conf.d/opencv.conf'




/usr/local/lib을 찾은 경우나 못찾아서 추가한 작업을 한 경우 모두 컴파일시 opencv  라이브러리를 찾을 수 있도록 다음 명령을 실행합니다.


webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$ sudo ldconfig




5. OpenCV 설치 결과 확인 

5.1. C/C++

앞에서도 언급했듯이 OpenCV 4.0.1에서 pkg-config를 디폴트로 지원하지 않습니다. 

그래서 CMake를 사용해서 컴파일 해야 합니다. 


opencv대신에 opencv4를 사용하면 pkg-config를 사용하여 컴파일할 수 있습니다. 

OpenCV 4.0.1 에선 -std=c++11을 붙여줘야 합니다.


$ g++ -o facedetect /usr/local/share/opencv4/samples/cpp/facedetect.cpp $(pkg-config opencv4 --libs --cflags) -std=c++11



실행시켜보면 얼굴 인식이 됩니다. 

$ ./facedetect --cascade="/usr/local/share/opencv4/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade="/usr/local/share/opencv4/haarcascades/haarcascade_eye_tree_eyeglasses.xml" --scale=1.3



다음 포스팅도 참고하세요. 



Visual Studio Code에서 CMake 사용하여 OpenCV 코드 컴파일 하기

https://webnautes.tistory.com/933 





5.2. Python

1. python 2.x와 python 3x에서 opencv 라이브러리를 사용가능한지는 다음처럼 확인합니다.

각각 OpenCV 버전이 출력되어야 합니다.

webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$ python
Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34) 

[GCC 7.3.0] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import cv2

>>> cv2.__version__

'4.0.1'

>>> 



webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$ python3
Python 3.6.5 (default, Apr  1 2018, 05:46:30) 

[GCC 7.3.0] on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> import cv2

>>> cv2.__version__

'4.0.1'

>>> 




3. 예제 코드를 실행해봅니다.


$  python /usr/local/share/opencv4/samples/python/facedetect.py --cascade "/usr/local/share/opencv4/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade "/usr/local/share/opencv4/haarcascades/haarcascade_eye_tree_eyeglasses.xml" /dev/video0



$  python3 /usr/local/share/opencv4/samples/python/facedetect.py --cascade "/usr/local/share/opencv4/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade "/usr/local/share/opencv4/haarcascades/haarcascade_eye_tree_eyeglasses.xml" /dev/video0




다음처럼  터미널에 표시되면서 카메라 영상에 얼굴이 검출된 결과를 얻을 수 있습니다.


python2


webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$  python /usr/local/share/opencv4/samples/python/facedetect.py --cascade "/usr/local/share/opencv4/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade "/usr/local/share/opencv4/haarcascades/haarcascade_eye_tree_eyeglasses.xml" /dev/video0


face detection using haar cascades


USAGE:

    facedetect.py [--cascade <cascade_fn>] [--nested-cascade <cascade_fn>] [<video_source>]


[ INFO:0] Initialize OpenCL runtime...



python3


webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$   python3 /usr/local/share/opencv4/samples/python/facedetect.py --cascade "/usr/local/share/opencv4/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade "/usr/local/share/opencv4/haarcascades/haarcascade_eye_tree_eyeglasses.xml" /dev/video0


face detection using haar cascades


USAGE:

    facedetect.py [--cascade <cascade_fn>] [--nested-cascade <cascade_fn>] [<video_source>]


[ INFO:0] Initialize OpenCL runtime...




4. 이제 필요 없어진 컴파일에 사용했던 opencv 소스코드 디렉토리를 삭제합니다.


webnautes@webnautes-pc:~/opencv/opencv-4.0.1/build$ cd
webnautes@webnautes-pc:~$ rm -rf opencv





반응형

포스트 작성시에는 문제 없었지만 이후 문제가 생길 수 있습니다.
댓글로 알려주시면 빠른 시일내에 답변을 드리겠습니다.

여러분의 응원으로 좋은 컨텐츠가 만들어집니다.
지금 본 내용이 도움이 되었다면 유튜브 구독 부탁드립니다. 감사합니다 : )

유튜브 구독하기


제가 쓴 책도 한번 검토해보세요.

  1. 이전 댓글 더보기
  2. Favicon of https://mason-lee.tistory.com BlogIcon 용산동쌍가락지 2019.04.08 21:34 신고

    감사합니다~
    with CUDA로 특정버전을 어떻게하면 깔 수 있나 찾아보고있었는데
    한국어로 잘 정리가 되어있어서 좋았네요~~

  3. BlogIcon HHH1234 2019.05.12 23:42

    패키지 설치할때 libgl1-mesa-dri 이 패키지만 설치가 안돼네요.. 오류메시지는

    다음 패키지의 의존성이 맞지 않습니다.
    unity-control-center : 의존 : libcheese-gtk23 (>= 3.4.0) 하지만 %s 패키지를 설치 하지 않을 것입니다.
    의존 : libcheese7 ( >= 3.0.1) 하지만 %s 패키지를 설치하지 않을 것입니다.

    E: 오류, pkgProblemResolver :: Resolve가 망가졌습니다. 고정 패키지때문에 발생할 수도 있습니다.

    이런 오류메세지 가 뜹니다 무슨 문제인지 궁금하네요...

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.12 23:45 신고

      다음 글을 참고하세요

      https://dololak.tistory.com/114

    • HHH1234 2019.05.13 00:04

      libcheese-gtk23 이랑 libcheese7 을 설치하려는데 버전이 없다해서 그냥 install 하니까 이미 최신버전이라고 하고 libgl1-mesa-dri 설치하니까 똑같은 오류만 납니다. 환경은 우분투 사용하고 있습니다.

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.13 09:30 신고

      opengl을 사용안할거라면 WITH_OPENGL 옵션을 빼고하는 것도 좋을듯합니다. 설치가 안되는 패키지가 OPENGL 관련 패키지입니다

  4. Favicon of https://data-newbie.tistory.com BlogIcon 분석뉴비 2019.05.14 14:33 신고

    안녕하세요 글 잘 보고 있습니다!!
    전 python에서 opencv를 진행하려고 하는데요!
    현재 저는 anaconda로 하고 있습니다 그리고 버전은 3.5나 3.6 을 쓰고 있는데요
    cmake를 해서 확인을 해보니 다음과 같이 나와서
    Python (for build): /usr/bin/python2.7
    ```` 수정한부분 ````
    -D PYTHON3_INCLUDE_DIR=/usr/include/python3.5m \
    -D PYTHON3_NUMPY_INCLUDE_DIRS=/root/anaconda3/lib/python3.6/site-packages/numpy/core/include/ \
    -D PYTHON3_PACKAGES_PATH=/root/anaconda3/lib/python3.6/site-packages \
    -D PYTHON3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1 \
    ````````````````
    수정을 하고 다음과 같이 cmake를 진행하니 다음과 같은 에러가 발생합니다!!!
    ```` ERROR `````````
    collect2: error: ld returned 1 exit status
    apps/version/CMakeFiles/opencv_version.dir/build.make:95: 'bin/opencv_version' 타겟에 대한 명령이 실패했습니다
    make[2]: *** [bin/opencv_version] 오류 1
    CMakeFiles/Makefile2:8724: 'apps/version/CMakeFiles/opencv_version.dir/all' 타겟에 대한 명령이 실패했습니다
    make[1]: *** [apps/version/CMakeFiles/opencv_version.dir/all] 오류 2
    make[1]: *** 끝나지 않은 작업을 기다리고 있습니다....
    [ 49%] Built target opencv_imgproc
    Makefile:160: 'all' 타겟에 대한 명령이 실패했습니다
    make: *** [all] 오류 2
    ```````````````````````
    어떻게 해결 할 수 있을까요?
    좋은 글 써주셔서 감사합니다!

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.14 14:38 신고

      anaconda를 사용하지 않기 때문에 검색을 해보니 다음 글이 보이네요..

      참고하여 진행해보세요.

      https://www.nerdluecht.de/index.php/2018/10/15/compile-opencv-3-4-3-for-anaconda-python-3-7/

  5. Favicon of https://data-newbie.tistory.com BlogIcon 분석뉴비 2019.05.14 16:03 신고

    안녕하세요 위아 아나콘다로 진행을 하고 있는데 다음과 같인 에러가 뜨네요 ㅠㅠㅠ


    [ 36%] Built target libprotobuf
    Makefile:160: 'all' 타겟에 대한 명령이 실패했습니다
    make: *** [all] 오류 2

    ㅠㅠㅠ

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.14 16:06 신고

      구글에서 검색한 결과를 하나씩 적용해보는 수 밖에 없는 듯합니다.

  6. Favicon of https://data-newbie.tistory.com BlogIcon 분석뉴비 2019.05.14 16:26 신고

    답변 감사드립니다. 먼가 찾아보니 가상환경에서 하는 것이 어렵다 하는 것 같기도하고 ㅠㅠㅠ
    너무 몰라서 어렵네요
    더 찾아 보겠습니다!

  7. 강상연 2019.05.24 19:48

    cmake 명령하는 부분에서
    -- Configuring incomplete, errors occurred!
    See also "/home/ksy/opencv/opencv-3.2.0/build/CMakeFiles/CMakeOutput.log".
    See also "/home/ksy/opencv/opencv-3.2.0/build/CMakeFiles/CMakeError.

    이렇게 떠서 opencv build가 안되는데 어떻게 해야하나요..

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.24 20:14 신고

      cmake 명령과 실행결과를 같이 올려주세요

    • 강상연 2019.05.24 22:58

      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_OPENGL=ON \
      -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules \
      -D WITH_V4L=ON \
      -D WITH_FFMPEG=OFF \
      -D WITH_XINE=ON \
      -D BUILD_NEW_PYTHON_SUPPORT=ON \
      ../



      위 명령어를 입력하였더니



      -- Detected version of GNU GCC: 54 (504)
      -- FP16: Feature disabled
      -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
      -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
      By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "Qt5Core", but
      CMake did not find one.

      Could not find a package configuration file provided by "Qt5Core" with any
      of the following names:

      Qt5CoreConfig.cmake
      qt5core-config.cmake

      Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
      "Qt5Core_DIR" to a directory containing one of the above files. If
      "Qt5Core" provides a separate development package or SDK, be sure it has
      been installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
      By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "Qt5Gui", but
      CMake did not find one.

      Could not find a package configuration file provided by "Qt5Gui" with any
      of the following names:

      Qt5GuiConfig.cmake
      qt5gui-config.cmake

      Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
      "Qt5Gui_DIR" to a directory containing one of the above files. If "Qt5Gui"
      provides a separate development package or SDK, be sure it has been
      installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
      By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
      has asked CMake to find a package configuration file provided by
      "Qt5Widgets", but CMake did not find one.

      Could not find a package configuration file provided by "Qt5Widgets" with
      any of the following names:

      Qt5WidgetsConfig.cmake
      qt5widgets-config.cmake

      Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
      "Qt5Widgets_DIR" to a directory containing one of the above files. If
      "Qt5Widgets" provides a separate development package or SDK, be sure it has
      been installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
      By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "Qt5Test", but
      CMake did not find one.

      Could not find a package configuration file provided by "Qt5Test" with any
      of the following names:

      Qt5TestConfig.cmake
      qt5test-config.cmake

      Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
      "Qt5Test_DIR" to a directory containing one of the above files. If
      "Qt5Test" provides a separate development package or SDK, be sure it has
      been installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
      By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
      project has asked CMake to find a package configuration file provided by
      "Qt5Concurrent", but CMake did not find one.

      Could not find a package configuration file provided by "Qt5Concurrent"
      with any of the following names:

      Qt5ConcurrentConfig.cmake
      qt5concurrent-config.cmake

      Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
      "Qt5Concurrent_DIR" to a directory containing one of the above files. If
      "Qt5Concurrent" provides a separate development package or SDK, be sure it
      has been installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      -- Looking for Q_WS_X11
      -- Looking for Q_WS_X11 - found
      -- Looking for Q_WS_WIN
      -- Looking for Q_WS_WIN - not found
      -- Looking for Q_WS_QWS
      -- Looking for Q_WS_QWS - not found
      -- Looking for Q_WS_MAC
      -- Looking for Q_WS_MAC - not found
      -- Found Qt4: /usr/bin/qmake (found version "4.8.7")
      -- Checking for module 'libxine'
      -- Found libxine, version 1.2.6
      -- Looking for linux/videodev.h
      -- Looking for linux/videodev.h - not found
      -- Looking for linux/videodev2.h
      -- Looking for linux/videodev2.h - found
      -- Looking for sys/videoio.h
      -- Looking for sys/videoio.h - not found
      -- Checking for module 'libgphoto2'
      -- No package 'libgphoto2' found
      -- CUDA detected: 9.0
      -- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
      -- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
      -- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
      -- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
      -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
      -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
      CMake Error at cmake/OpenCVModule.cmake:295 (message):
      No extra modules found in folder:
      /home/cellina7702/opencv/opencv_contrib-3.4.0/modules

      Please provide path to 'opencv_contrib/modules' folder.
      Call Stack (most recent call first):
      modules/CMakeLists.txt:7 (ocv_glob_modules)


      --
      -- General configuration for OpenCV 3.2.0 =====================================
      -- Version control: unknown
      --
      -- Platform:
      -- Timestamp: 2019-05-24T13:56:40Z
      -- Host: Linux 4.15.0-46-generic x86_64
      -- CMake: 3.5.1
      -- CMake generator: Unix Makefiles
      -- CMake build tool: /usr/bin/make
      -- Configuration: RELEASE
      --
      -- C/C++:
      -- Built as dynamic libs?: YES
      -- C++ Compiler: /usr/bin/c++ (ver 5.4.0)
      -- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
      -- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
      -- C Compiler: /usr/bin/cc
      -- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
      -- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
      -- Linker flags (Release):
      -- Linker flags (Debug):
      -- ccache: NO
      -- Precompiled headers: YES
      -- Extra dependencies: /usr/lib/x86_64-linux-gnu/libQtOpenGL.so /usr/lib/x86_64-linux-gnu/libQtGui.so /usr/lib/x86_64-linux-gnu/libQtTest.so /usr/lib/x86_64-linux-gnu/libQtCore.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so gstvideo-1.0 gstapp-1.0 gstbase-1.0 gstriff-1.0 gstpbutils-1.0 gstreamer-1.0 gobject-2.0 glib-2.0 xine dl m pthread rt /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so cudart nppc nppi npps cufft -L/usr/local/cuda/lib64 -L/usr/lib/x86_64-linux-gnu
      -- 3rdparty dependencies: libwebp IlmImf
      --
      -- OpenCV modules:
      -- To be built: cudev core cudaarithm flann imgproc ml video cudabgsegm cudafilters cudaimgproc cudawarping imgcodecs photo shape videoio cudacodec highgui objdetect ts features2d calib3d cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo stitching superres videostab python2 python3
      -- Disabled: world
      -- Disabled by dependency: -
      -- Unavailable: java viz
      --
      -- GUI:
      -- QT 4.x: YES (ver 4.8.7 EDITION = OpenSource)
      -- QT OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so)
      -- OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so)
      -- VTK support: NO
      --
      -- Media I/O:
      -- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
      -- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
      -- WEBP: build (ver 0.3.1)
      -- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54)
      -- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.6)
      -- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
      -- OpenEXR: build (ver 1.7.1)
      -- GDAL: NO
      -- GDCM: NO
      --
      -- Video I/O:
      -- DC1394 1.x: NO
      -- DC1394 2.x: NO
      -- FFMPEG: NO
      -- avcodec: NO
      -- avformat: NO
      -- avutil: NO
      -- swscale: NO
      -- avresample: NO
      -- GStreamer:
      -- base: YES (ver 1.8.3)
      -- video: YES (ver 1.8.3)
      -- app: YES (ver 1.8.3)
      -- riff: YES (ver 1.8.3)
      -- pbutils: YES (ver 1.8.3)
      -- OpenNI: NO
      -- OpenNI PrimeSensor Modules: NO
      -- OpenNI2: NO
      -- PvAPI: NO
      -- GigEVisionSDK: NO
      -- Aravis SDK: NO
      -- UniCap: NO
      -- UniCap ucil: NO
      -- V4L/V4L2: NO/YES
      -- XIMEA: NO
      -- Xine: YES (ver 1.2.6)
      -- gPhoto2: NO
      --
      -- Parallel framework: pthreads
      --
      -- Other third-party libraries:
      -- Use IPP: NO
      -- Use IPP Async: NO
      -- Use VA: NO
      -- Use Intel VA-API/OpenCL: NO
      -- Use Lapack: NO
      -- Use Eigen: YES (ver 3.2.92)
      -- Use Cuda: YES (ver 9.0)
      -- Use OpenCL: YES
      -- Use OpenVX: NO
      -- Use custom HAL: NO
      --
      -- NVIDIA CUDA
      -- Use CUFFT: YES
      -- Use CUBLAS: NO
      -- USE NVCUVID: NO
      -- NVIDIA GPU arch: 20 30 35 37 50 52 60 61
      -- NVIDIA PTX archs:
      -- Use fast math: NO
      --
      -- OpenCL: <Dynamic loading of OpenCL library>
      -- Include path: /home/cellina7702/opencv/opencv-3.2.0/3rdparty/include/opencl/1.2
      -- Use AMDFFT: NO
      -- Use AMDBLAS: NO
      --
      -- Python 2:
      -- Interpreter: /usr/bin/python2.7 (ver 2.7.12)
      -- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
      -- numpy: /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.16.2)
      -- packages path: /root/.virtualenvs/cv/lib/python2.7/site-packages
      --
      -- Python 3:
      -- Interpreter: /usr/bin/python3 (ver 3.5.2)
      -- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)
      -- numpy: /usr/local/lib/python3.5/dist-packages/numpy/core/include (ver 1.14.5)
      -- packages path: lib/python3.5/dist-packages
      --
      -- Python (for build): /usr/bin/python2.7
      --
      -- Java:
      -- ant: NO
      -- JNI: NO
      -- Java wrappers: NO
      -- Java tests: NO
      --
      -- Matlab: Matlab not found or implicitly disabled
      --
      -- Tests and samples:
      -- Tests: NO
      -- Performance tests: NO
      -- C/C++ Examples: NO
      --
      -- Install path: /usr/local
      --
      -- cvconfig.h is in: /home/cellina7702/opencv/opencv-3.2.0
      -- -----------------------------------------------------------------
      --
      CMake Warning at CMakeLists.txt:1356 (message):
      The source directory is the same as binary directory. "make clean" may
      damage the source tree


      -- Configuring incomplete, errors occurred!
      See also "/home/cellina7702/opencv/opencv-3.2.0/CMakeFiles/CMakeOutput.log".
      See also "/home/cellina7702/opencv/opencv-3.2.0/CMakeFiles/CMakeError.log".

      다음과 같은 결과가 나왔습니다.. 죄송합니다 정확히 어느부분을 보여드려야할지 몰라서 이단 다 복사했습니다..

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.24 23:10 신고

      아래부분을 현재 설치하려는 OpenCV 버전과 일치시켜줘야 합니다. 3.4.0 대신에 3.2.0을 입력하면 될듯합니다.

      -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules \

    • 강상연 2019.05.24 23:39

      ..감사합니다 !!!!!

    • 강상연 2019.05.24 23:44

      root@devbox-titanx:/home/cellina7702/opencv/opencv-3.2.0/build# cat /proc/cpuinfo | grep processor | wc -l


      12


      root@devbox-titanx:/home/cellina7702/opencv/opencv-3.2.0/build# time make -j12


      make: *** No targets specified and no makefile found. Stop.

      real 0m0.003s
      user 0m0.003s
      sys 0m0.000s



      혹시 다음과 같은 error도 여쭤봐도 될까요..

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.24 23:47 신고

      현재 폴더에 makefile이 없다는 에러입니다. cmake결과 생성되야하는 파일입니다

    • 강상연 2019.05.24 23:51

      root@devbox-titanx:/home/cellina7702/opencv/opencv-3.2.0/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_OPENGL=ON \
      > -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules \
      > -D WITH_V4L=ON \
      > -D WITH_FFMPEG=OFF \
      > -D WITH_XINE=ON \
      > -D BUILD_NEW_PYTHON_SUPPORT=ON \
      > ../
      -- Detected version of GNU GCC: 54 (504)
      -- FP16: Feature disabled
      -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
      -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
      By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "Qt5Core", but
      CMake did not find one.

      Could not find a package configuration file provided by "Qt5Core" with any
      of the following names:

      Qt5CoreConfig.cmake
      qt5core-config.cmake

      Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
      "Qt5Core_DIR" to a directory containing one of the above files. If
      "Qt5Core" provides a separate development package or SDK, be sure it has
      been installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
      By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "Qt5Gui", but
      CMake did not find one.

      Could not find a package configuration file provided by "Qt5Gui" with any
      of the following names:

      Qt5GuiConfig.cmake
      qt5gui-config.cmake

      Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
      "Qt5Gui_DIR" to a directory containing one of the above files. If "Qt5Gui"
      provides a separate development package or SDK, be sure it has been
      installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
      By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
      has asked CMake to find a package configuration file provided by
      "Qt5Widgets", but CMake did not find one.

      Could not find a package configuration file provided by "Qt5Widgets" with
      any of the following names:

      Qt5WidgetsConfig.cmake
      qt5widgets-config.cmake

      Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
      "Qt5Widgets_DIR" to a directory containing one of the above files. If
      "Qt5Widgets" provides a separate development package or SDK, be sure it has
      been installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
      By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "Qt5Test", but
      CMake did not find one.

      Could not find a package configuration file provided by "Qt5Test" with any
      of the following names:

      Qt5TestConfig.cmake
      qt5test-config.cmake

      Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
      "Qt5Test_DIR" to a directory containing one of the above files. If
      "Qt5Test" provides a separate development package or SDK, be sure it has
      been installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
      By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
      project has asked CMake to find a package configuration file provided by
      "Qt5Concurrent", but CMake did not find one.

      Could not find a package configuration file provided by "Qt5Concurrent"
      with any of the following names:

      Qt5ConcurrentConfig.cmake
      qt5concurrent-config.cmake

      Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
      "Qt5Concurrent_DIR" to a directory containing one of the above files. If
      "Qt5Concurrent" provides a separate development package or SDK, be sure it
      has been installed.
      Call Stack (most recent call first):
      CMakeLists.txt:556 (include)


      -- Looking for linux/videodev.h
      -- Looking for linux/videodev.h - not found
      -- Looking for linux/videodev2.h
      -- Looking for linux/videodev2.h - found
      -- Looking for sys/videoio.h
      -- Looking for sys/videoio.h - not found
      -- Checking for module 'libgphoto2'
      -- No package 'libgphoto2' found
      -- CUDA detected: 9.0
      -- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
      -- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
      -- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
      -- Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
      -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
      -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
      -- Caffe: NO
      -- Protobuf: NO
      -- Glog: NO
      -- freetype2: YES
      -- harfbuzz: YES
      -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
      -- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
      -- freetype2: YES
      -- harfbuzz: YES
      -- Checking for modules 'tesseract;lept'
      -- No package 'tesseract' found
      -- No package 'lept' found
      -- Tesseract: NO
      -- Check contents of vgg_generated_48.i ...
      -- Check contents of vgg_generated_64.i ...
      -- Check contents of vgg_generated_80.i ...
      -- Check contents of vgg_generated_120.i ...
      -- Check contents of boostdesc_bgm.i ...
      -- Check contents of boostdesc_bgm_bi.i ...
      -- Check contents of boostdesc_bgm_hd.i ...
      -- Check contents of boostdesc_binboost_064.i ...
      -- Check contents of boostdesc_binboost_128.i ...
      -- Check contents of boostdesc_binboost_256.i ...
      -- Check contents of boostdesc_lbgm.i ...
      --
      -- General configuration for OpenCV 3.2.0 =====================================
      -- Version control: unknown
      --
      -- Extra modules:
      -- Location (extra): /home/cellina7702/opencv/opencv_contrib-3.2.0/modules
      -- Version control (extra): unknown
      --
      -- Platform:
      -- Timestamp: 2019-05-24T14:49:41Z
      -- Host: Linux 4.15.0-46-generic x86_64
      -- CMake: 3.5.1
      -- CMake generator: Unix Makefiles
      -- CMake build tool: /usr/bin/make
      -- Configuration: RELEASE
      --
      -- C/C++:
      -- Built as dynamic libs?: YES
      -- C++ Compiler: /usr/bin/c++ (ver 5.4.0)
      -- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
      -- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
      -- C Compiler: /usr/bin/cc
      -- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
      -- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-comment -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -ffunction-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
      -- Linker flags (Release):
      -- Linker flags (Debug):
      -- ccache: NO
      -- Precompiled headers: YES
      -- Extra dependencies: /usr/lib/x86_64-linux-gnu/libQtOpenGL.so /usr/lib/x86_64-linux-gnu/libQtGui.so /usr/lib/x86_64-linux-gnu/libQtTest.so /usr/lib/x86_64-linux-gnu/libQtCore.so /usr/lib/x86_64-linux-gnu/libpng.so /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/x86_64-linux-gnu/libtiff.so /usr/lib/x86_64-linux-gnu/libjasper.so /usr/lib/x86_64-linux-gnu/libjpeg.so gstvideo-1.0 gstapp-1.0 gstbase-1.0 gstriff-1.0 gstpbutils-1.0 gstreamer-1.0 gobject-2.0 glib-2.0 xine dl m pthread rt /usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so cudart nppc nppi npps cufft -L/usr/local/cuda/lib64 -L/usr/lib/x86_64-linux-gnu
      -- 3rdparty dependencies: libwebp IlmImf libprotobuf
      --
      -- OpenCV modules:
      -- To be built: cudev core cudaarithm flann imgproc ml reg surface_matching video cudabgsegm cudafilters cudaimgproc cudawarping dnn freetype fuzzy imgcodecs photo shape videoio cudacodec highgui objdetect plot ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo datasets rgbd stereo superres tracking videostab xfeatures2d ximgproc aruco optflow phase_unwrapping stitching structured_light python2 python3
      -- Disabled: world contrib_world
      -- Disabled by dependency: -
      -- Unavailable: java viz cnn_3dobj cvv hdf matlab sfm
      --
      -- GUI:
      -- QT 4.x: YES (ver 4.8.7 EDITION = OpenSource)
      -- QT OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so)
      -- OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGLU.so /usr/lib/x86_64-linux-gnu/libGL.so)
      -- VTK support: NO
      --
      -- Media I/O:
      -- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.8)
      -- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
      -- WEBP: build (ver 0.3.1)
      -- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.54)
      -- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.0.6)
      -- JPEG 2000: /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
      -- OpenEXR: build (ver 1.7.1)
      -- GDAL: NO
      -- GDCM: NO
      --
      -- Video I/O:
      -- DC1394 1.x: NO
      -- DC1394 2.x: NO
      -- FFMPEG: NO
      -- avcodec: NO
      -- avformat: NO
      -- avutil: NO
      -- swscale: NO
      -- avresample: NO
      -- GStreamer:
      -- base: YES (ver 1.8.3)
      -- video: YES (ver 1.8.3)
      -- app: YES (ver 1.8.3)
      -- riff: YES (ver 1.8.3)
      -- pbutils: YES (ver 1.8.3)
      -- OpenNI: NO
      -- OpenNI PrimeSensor Modules: NO
      -- OpenNI2: NO
      -- PvAPI: NO
      -- GigEVisionSDK: NO
      -- Aravis SDK: NO
      -- UniCap: NO
      -- UniCap ucil: NO
      -- V4L/V4L2: NO/YES
      -- XIMEA: NO
      -- Xine: YES (ver 1.2.6)
      -- gPhoto2: NO
      --
      -- Parallel framework: pthreads
      --
      -- Other third-party libraries:
      -- Use IPP: NO
      -- Use IPP Async: NO
      -- Use VA: NO
      -- Use Intel VA-API/OpenCL: NO
      -- Use Lapack: NO
      -- Use Eigen: YES (ver 3.2.92)
      -- Use Cuda: YES (ver 9.0)
      -- Use OpenCL: YES
      -- Use OpenVX: NO
      -- Use custom HAL: NO
      --
      -- NVIDIA CUDA
      -- Use CUFFT: YES
      -- Use CUBLAS: NO
      -- USE NVCUVID: NO
      -- NVIDIA GPU arch: 20 30 35 37 50 52 60 61
      -- NVIDIA PTX archs:
      -- Use fast math: NO
      --
      -- OpenCL: <Dynamic loading of OpenCL library>
      -- Include path: /home/cellina7702/opencv/opencv-3.2.0/3rdparty/include/opencl/1.2
      -- Use AMDFFT: NO
      -- Use AMDBLAS: NO
      --
      -- Python 2:
      -- Interpreter: /usr/bin/python2.7 (ver 2.7.12)
      -- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
      -- numpy: /usr/local/lib/python2.7/dist-packages/numpy/core/include (ver 1.16.2)
      -- packages path: /root/.virtualenvs/cv/lib/python2.7/site-packages
      --
      -- Python 3:
      -- Interpreter: /usr/bin/python3 (ver 3.5.2)
      -- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.5m.so (ver 3.5.2)
      -- numpy: /usr/local/lib/python3.5/dist-packages/numpy/core/include (ver 1.14.5)
      -- packages path: lib/python3.5/dist-packages
      --
      -- Python (for build): /usr/bin/python2.7
      --
      -- Java:
      -- ant: NO
      -- JNI: NO
      -- Java wrappers: NO
      -- Java tests: NO
      --
      -- Matlab: Matlab not found or implicitly disabled
      --
      -- Tests and samples:
      -- Tests: NO
      -- Performance tests: NO
      -- C/C++ Examples: NO
      --
      -- Install path: /usr/local
      --
      -- cvconfig.h is in: /home/cellina7702/opencv/opencv-3.2.0
      -- -----------------------------------------------------------------
      --
      CMake Warning at CMakeLists.txt:1356 (message):
      The source directory is the same as binary directory. "make clean" may
      damage the source tree


      -- Configuring done
      -- Generating done
      -- Build files have been written to: /home/cellina7702/opencv/opencv-3.2.0



      이렇게 결과가 나와서 성공한줄알았는데 실패된건가요?

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.24 23:57 신고

      opencv-3
      2.0/build에 생겨야 할파일이 opencv-3.2.0에 생성되었네요.

      포스트에 있는 명령과 다르게 적힌부분이 없나 확인해보세요

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.25 00:18 신고

      의미가 잘못 전달되었군요. cmake문에 오타가 있는듯합니다. 포스트와 비교해보세요.

    • 강상연 2019.05.25 02:46

      정말 감사합니다!

  8. Favicon of http://github.com/jaehyunup BlogIcon 박재현 2019.05.29 20:05

    vmware 기반 우분투 설치중 쓰레드 옵션 (-j) 적용하기전 메모리 공간 스왑파일 생성을 안해주면 90퍼~100퍼대에서 뻗는 오류가 있습니다 글쓴이님.
    참고 (https://stackoverflow.com/questions/41733306/opencv-installation-stuck-at-99-built-target-opencv-perf-stitching-with-no-e)
    저처럼 저용량으로 사용하시는분들을 위해 글에 추가해주시면 좋을것같아요

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.05.29 20:14 신고

      감사합니다 : )
      VMWARE에서도 문제가 발생하는것을 첨 알았네요..
      알려주신 내용 추가해놓겠습니다.
      혹시 용량을 얼마정도로 하셨나요?

      얘기하신건 PC의 경우라 상황이 다르긴 하지만

      라즈베리파이에서도 같은 현상이 발생해서 스왑영역을 늘려서 해결했었는데.. 안되는 경우도 있습니다.

      확실한 방법은 j 옵션없이 make만 사용하는 게 아닐까 싶기도 합니다.


  9. 무코포 2019.06.03 15:13

    잘 정리해주셔서 감사합니다.
    알려주신대로 모두 설치했고
    pkg-config --modversion opencv
    pkg-config --libs --cflags opencv
    를 실행해보면 정상적으로 설치가 되었다고 나오는데요
    막상 파이썬에서 import cv2를 하면 없다고 나오네요
    anaconda를 쓰고 있긴한데 가상환경 없이 그냥 실행해도 되지를 않네요
    그리고 cmake할 때 아무리 설정을 바꿔봐도 python2만 나오고 python3는 안나옵니다
    며칠째 삽질을 하고 있습니다. 도와주세요 ㅠㅠ

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.06.03 17:55 신고

      포스트에서 다음 부분아래에 있는 것처럼 파이썬 2 관련 옵션을 직접 추가해줘야 합니다.

      "
      붉은색 줄처럼 해당 경로들을 직접 적어줘야 합니다. 포스팅에서 사용한 옵션과 차이가 있을 수 있습니다.
      "

  10. tha 2019.07.02 20:42

    Hello?
    After I do
    make -j,
    errors occur...

    /opencv/opencv_contrib-4.0.1/modules/xfeatures2d/src/boostdesc.cpp:653:37: fatal error: boostdesc_bgm.i: No such file or directory
    compilation terminated.

    What is "fatal error: boostdesc_bgm.i: No such file or directory
    compilation terminated."?

    Thank you.

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.07.02 22:01 신고

      When you run cmake, it will download the boostdesc_bgm.i file.
      After running cmake, make sure you see the following message:

      -- xfeatures2d/boostdesc: Download: boostdesc_bgm.i
      -- xfeatures2d/boostdesc: Download: boostdesc_bgm_bi.i
      -- xfeatures2d/boostdesc: Download: boostdesc_bgm_hd.i
      -- xfeatures2d/boostdesc: Download: boostdesc_binboost_064.i
      -- xfeatures2d/boostdesc: Download: boostdesc_binboost_128.i
      -- xfeatures2d/boostdesc: Download: boostdesc_binboost_256.i
      -- xfeatures2d/boostdesc: Download: boostdesc_lbgm.i

  11. greenhorn 2019.07.04 11:58

    먼저 자세히 설명해주셔서 정말 감사합니다! 덕분에 많은 도움이 됐습니다.
    근데 OpenCV 컴파일 설정 결과에 Python 3 라이브러리 항목이 뜨지 않아 작성자님이 알려주신대로 했음에도 불구하고 Python3 부분만 뜨질 않네요.. 일단 컴파일을 시작했는데 없이 진행해도 괜찮은가요..?

    결과화면 ->
    -- Python 2:
    -- Interpreter: /usr/bin/python2.7 (ver 2.7.12)
    -- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.12)
    -- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include/ (ver 1.11.0)
    -- install path: /usr/lib/python2.7/dist-packages/cv2/python-2.7
    --
    -- Python (for build): /usr/bin/python2.7

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.07.04 12:30 신고

      파이썬3에서 OpenCV를 사용하지 않는다면 빼고 진행해도 됩니다.

  12. greenhorn 2019.07.04 13:39

    질문 하나만 더 드립니다.. 설치 완료하고 예제 코드를 실행했는데 다음과 같은 에러가 뜹니다ㅠ
    (python:26383): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
    GStreamer: Error opening bin: no source element for URI "/dev/video0"

    (python:26383): GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed
    Warning: unable to open video source: /dev/video0
    : cannot connect to X server

    /dev/video0 는 따로 다운받아야 되는건가요?
    좋은 글 올려주셨는데 번거롭게 해드려 죄송합니다.

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.07.04 13:42 신고

      웹캠에서 영상을 얻을 수 없다는 에러입니다.

      아래 링크의 코드로 테스트해보세요
      https://webnautes.tistory.com/1351

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.07.04 13:43 신고

      video0 파일은 웹캠이 인식되면 자동으로 생성되는 파일입니다.

      이 파일을 통해 웹캠에 접근합니다.

    • greenhorn 2019.07.04 13:46

      감사합니다! 보내주신 링크로 확인해보도록 하겠습니다.

  13. 라이칸 2019.07.05 13:57


    E: libjasper-dev 패키지를 찾을 수 없습니다
    E: 'libpng12-dev' 패키지는 설치할 수 있는 후보가 없습니다

    이건 어떻게 해야하나요?

  14. jetson 2019.07.08 00:03

    안녕하세요 선생님

    잘보고 따라했는데요

    빌드과정에서 오류가납니다 ... 혹시 해결방법 알고있으신가요

    make[2]: *** 'lib/libopencv_core.so.4.0.1'에서 필요한 '/usr/lib/aarch64-linux-gnu/libGL.so' 타겟을 만들 규칙이 없습니다. 멈춤.

    CMakeFiles/Makefile2:2476: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed

    make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2

    Makefile:162: recipe for target 'all' failed

    make: *** [all] Error 2

    • jetson 2019.07.08 00:22

      우분투 16.04에 jetpack 4.2 입니다

    • jetson 2019.07.08 00:44

      추가 질문입니다

      cv를 빌드를 하는 이유는뭔가요

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.07.08 11:34 신고

      cmake시 다음 옵션을 OFF로 바꾸고 해보세요

      -D WITH_OPENGL=OFF


      리눅스의 경우에도 미리 빌드되어 배포되기도 하지만..
      최신 버전이 아니기때문에 보통 빌드해서 사용합니다.

  15. JR 2019.07.11 00:11

    안녕하세요! openCV 설치가 참 까다로운데 처음 해보는 사람에게도 친절하고 알기 쉽게 정리 해놓은 보기 드문 글에 도움 많이 받고 갑니다.
    여러번 설치할 때마다 도움이 됐는데 이번에 다시 해보니 오류가 뜹니다.

    cmake 빌드까지 잘 진행 됐는데요
    make를 하니 오류가 이렇게 뜹니다

    [ 19%] Linking C static library ../lib/liblibwebp.a
    [ 19%] Built target libwebp
    [ 19%] Linking CXX static library ../lib/liblibprotobuf.a
    [ 19%] Built target libprotobuf
    Makefile:160: recipe for target 'all' failed
    make: *** [all] Error 2

    real 0m18.386s
    user 2m8.015s
    sys 0m7.638s

    환경은 우분투 16.04 이고 openCV버전을 임의로 3.4.0 으로 숫자를 바꿔 설치를 진행했습니다.
    빌드 과정에서 모두 복사 붙여넣기 하고 4.0.1 만 3.4.0 으로 바꾼 것이기 때문에 오타는 없었습니다..!
    어떻게 해결하면 좋을지 조언 부탁드려요ㅜㅜ

  16. ubun 2019.07.30 17:10

    다 따라하고 마지막에 rm 으로 삭제했는데 opencv 자체가 다 삭제된건가요? darknet에서 opencv 쓸려고 하는데 다시 깔아야 되나요?

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.07.30 20:07 신고

      필요없어진 소스 폴더를 삭제한겁니다.
      다음 명령시 opencv 컴파일 옵션이 보이나 보세요.

      pkg-config opencv4 --libs --cflags

  17. putty 2019.11.22 13:53

    안녕하세요! 설명을 차근차근 잘 해 주셔서 잘 따라갈 수 있었습니다! 그런데 문제가 하나 생겨서요ㅠㅠ 본문과 맥락이 전혀 다르긴 하지만 혹시 자문을 구할 수 있을지,, 댓글을 남깁니다. 저의 경우 putty로 서버를 구동하여 그곳에 opencv를 설치하려고 하는데, 컴파일 마지막 단계(100%)에서 진행이 멈추고 서버와 connection이 끊겨 버립니다ㅠㅠ.. 혹시 이 컴파일 단계가 서버에 과부하를 줄 정도로 큰 작업인가요..?

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2019.11.22 22:56 신고

      마지막 빌드과정에서 오래 걸리긴하지만 접속이 끊길정도는 아닙니다.

  18. DIS 2020.02.05 15:24

    Ubuntu 16.04 환경에서 사용 중입니다. 3.4.2가 깔려 있는데 pkg-config --modversion opencv 를 해보아도 0.0.0으로 밖에 나오질 않습니다. 다운 그레이드가 필요한 상황이라 3.2로 재설치 하고 있는데 삭제를 진행해도 0.0.0이라는 결과가 계속해서 나옵니다. 그런 이유인지 설치 진행 중 cmake 부분에서 계속 오류가 납니다. 어떻게 해결하면 될까요?

    ROS와 opecv를 같이 사용하고 있는데 혹시 그 과정에서 라이브러리를 사용하면서 제대로 삭제가 되지 않을 가능성도 있나요??

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.02.05 19:35 신고

      다음 명령으로 opencv를 완전히 제거할수 있습니다
      sudo find / -name "*opencv*" -exec rm -i {} \;

  19. simkslv 2020.02.13 23:19

    안녕하세요, 올리신 글 덕분에 OpenCV를 잘 설치하고 있습니다.
    다만 두번째 PC에서 설치를 진행하다보니 아래와 같은 오류가 발생 했는데, 구글링으로 이것 저것 시도 해봐도 좀처럼 풀리지가 않네요,
    혹시 도와주실 수 있을까요?

    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=ON -D INSTALL_C_EXAMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -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_ENABLE_NONFREE=ON -D OPENCV_GENERATE_PKGCONFIG=ON ../
    CMake Warning at cmake/OpenCVUtils.cmake:618 (message):
    Unexpected option: ENABLE_NEON (=ON)

    Condition: IF ((;CV_GCC;OR;CV_CLANG;);AND;(;ARM;OR;AARCH64;OR;IOS;))
    Call Stack (most recent call first):
    CMakeLists.txt:470 (OCV_OPTION)


    -- Looking for ccache - not found
    CMake Error at cmake/OpenCVCompilerOptimizations.cmake:477 (message):
    Required baseline optimization is not supported: NEON
    (CPU_BASELINE_REQUIRE=;NEON)
    Call Stack (most recent call first):
    cmake/OpenCVCompilerOptions.cmake:266 (include)
    CMakeLists.txt:703 (include)


    -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version "1.2.11", minimum required is "1.2.3")
    -- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
    -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
    CMake Warning at cmake/OpenCVFindLibsGUI.cmake:18 (find_package):
    By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "Qt5Core", but
    CMake did not find one.

    Could not find a package configuration file provided by "Qt5Core" with any
    of the following names:

    Qt5CoreConfig.cmake
    qt5core-config.cmake

    Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set
    "Qt5Core_DIR" to a directory containing one of the above files. If
    "Qt5Core" provides a separate development package or SDK, be sure it has
    been installed.
    Call Stack (most recent call first):
    CMakeLists.txt:782 (include)


    CMake Warning at cmake/OpenCVFindLibsGUI.cmake:19 (find_package):
    By not providing "FindQt5Gui.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "Qt5Gui", but
    CMake did not find one.

    Could not find a package configuration file provided by "Qt5Gui" with any
    of the following names:

    Qt5GuiConfig.cmake
    qt5gui-config.cmake

    Add the installation prefix of "Qt5Gui" to CMAKE_PREFIX_PATH or set
    "Qt5Gui_DIR" to a directory containing one of the above files. If "Qt5Gui"
    provides a separate development package or SDK, be sure it has been
    installed.
    Call Stack (most recent call first):
    CMakeLists.txt:782 (include)


    CMake Warning at cmake/OpenCVFindLibsGUI.cmake:20 (find_package):
    By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project
    has asked CMake to find a package configuration file provided by
    "Qt5Widgets", but CMake did not find one.

    Could not find a package configuration file provided by "Qt5Widgets" with
    any of the following names:

    Qt5WidgetsConfig.cmake
    qt5widgets-config.cmake

    Add the installation prefix of "Qt5Widgets" to CMAKE_PREFIX_PATH or set
    "Qt5Widgets_DIR" to a directory containing one of the above files. If
    "Qt5Widgets" provides a separate development package or SDK, be sure it has
    been installed.
    Call Stack (most recent call first):
    CMakeLists.txt:782 (include)


    CMake Warning at cmake/OpenCVFindLibsGUI.cmake:21 (find_package):
    By not providing "FindQt5Test.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "Qt5Test", but
    CMake did not find one.

    Could not find a package configuration file provided by "Qt5Test" with any
    of the following names:

    Qt5TestConfig.cmake
    qt5test-config.cmake

    Add the installation prefix of "Qt5Test" to CMAKE_PREFIX_PATH or set
    "Qt5Test_DIR" to a directory containing one of the above files. If
    "Qt5Test" provides a separate development package or SDK, be sure it has
    been installed.
    Call Stack (most recent call first):
    CMakeLists.txt:782 (include)


    CMake Warning at cmake/OpenCVFindLibsGUI.cmake:22 (find_package):
    By not providing "FindQt5Concurrent.cmake" in CMAKE_MODULE_PATH this
    project has asked CMake to find a package configuration file provided by
    "Qt5Concurrent", but CMake did not find one.

    Could not find a package configuration file provided by "Qt5Concurrent"
    with any of the following names:

    Qt5ConcurrentConfig.cmake
    qt5concurrent-config.cmake

    Add the installation prefix of "Qt5Concurrent" to CMAKE_PREFIX_PATH or set
    "Qt5Concurrent_DIR" to a directory containing one of the above files. If
    "Qt5Concurrent" provides a separate development package or SDK, be sure it
    has been installed.
    Call Stack (most recent call first):
    CMakeLists.txt:782 (include)


    -- Looking for linux/videodev.h
    -- Looking for linux/videodev.h - found
    -- Looking for linux/videodev2.h
    -- Looking for linux/videodev2.h - found
    -- Looking for sys/videoio.h
    -- Looking for sys/videoio.h - not found
    -- Checking for module 'libavresample'
    -- No package 'libavresample' found
    -- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
    -- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
    -- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
    -- A library with BLAS API found.
    -- A library with LAPACK API found.
    -- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
    -- Could NOT find Pylint (missing: PYLINT_EXECUTABLE)
    -- Could NOT find Flake8 (missing: FLAKE8_EXECUTABLE)
    -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
    -- OpenCV Python: during development append to PYTHONPATH: /home/simkslv/opencv/opencv-3.4.5/build/python_loader
    -- Caffe: NO
    -- Protobuf: NO
    -- Glog: NO
    -- Checking for one of the modules 'freetype2'
    -- Checking for one of the modules 'harfbuzz'
    -- freetype2: NO
    -- harfbuzz: NO
    -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found version "")
    -- Module opencv_ovis disabled because OGRE3D was not found
    -- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
    -- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
    -- Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
    -- Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
    -- Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
    -- Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
    -- Checking for modules 'tesseract;lept'
    -- No package 'tesseract' found
    -- No package 'lept' found
    -- Tesseract: NO
    -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
    -- OpenCL samples are skipped: OpenCL SDK is required
    --
    -- General configuration for OpenCV 3.4.5 =====================================
    -- Version control: unknown
    --
    -- Extra modules:
    -- Location (extra): /home/simkslv/opencv/opencv_contrib-3.4.5/modules
    -- Version control (extra): unknown
    --
    -- Platform:
    -- Timestamp: 2020-02-13T13:20:17Z
    -- Host: Linux 5.3.0-28-generic x86_64
    -- CMake: 3.10.2
    -- CMake generator: Unix Makefiles
    -- CMake build tool: /usr/bin/make
    -- Configuration: RELEASE
    --
    -- CPU/HW features:
    -- Baseline: SSE SSE2 SSE3
    -- requested: SSE3
    -- required: NEON
    -- Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
    -- requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
    -- SSE4_1 (4 files): + SSSE3 SSE4_1
    -- SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
    -- FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
    -- AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
    -- AVX2 (10 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
    -- AVX512_SKX (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_SKX
    --
    -- C/C++:
    -- Built as dynamic libs?: YES
    -- C++11: YES
    -- C++ Compiler: /usr/bin/c++ (ver 7.4.0)
    -- C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
    -- C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
    -- C Compiler: /usr/bin/cc
    -- C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
    -- C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
    -- Linker flags (Release):
    -- Linker flags (Debug):
    -- ccache: NO
    -- Precompiled headers: YES
    -- Extra dependencies: dl m pthread rt /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so
    -- 3rdparty dependencies:
    --
    -- OpenCV modules:
    -- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
    -- Disabled: world
    -- Disabled by dependency: -
    -- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype hdf java js matlab ovis python2 sfm ts viz
    -- Applications: examples apps
    -- Documentation: NO
    -- Non-free algorithms: YES
    --
    -- GUI:
    -- QT: YES (ver 4.8.7 EDITION = OpenSource)
    -- QT OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libQtOpenGL.so)
    -- OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so)
    -- VTK support: NO
    --
    -- Media I/O:
    -- ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
    -- JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
    -- WEBP: build (ver encoder: 0x020e)
    -- PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.34)
    -- TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
    -- JPEG 2000: build (ver 1.900.1)
    -- OpenEXR: build (ver 1.7.1)
    -- HDR: YES
    -- SUNRASTER: YES
    -- PXM: YES
    --
    -- Video I/O:
    -- FFMPEG: YES
    -- avcodec: YES (ver 57.107.100)
    -- avformat: YES (ver 57.83.100)
    -- avutil: YES (ver 55.78.100)
    -- swscale: YES (ver 4.8.100)
    -- avresample: NO
    -- GStreamer:
    -- base: YES (ver 1.14.5)
    -- video: YES (ver 1.14.5)
    -- app: YES (ver 1.14.5)
    -- riff: YES (ver 1.14.5)
    -- pbutils: YES (ver 1.14.5)
    -- libv4l/libv4l2: NO
    -- v4l/v4l2: linux/videodev.h linux/videodev2.h
    -- Xine: YES (ver 1.2.8)
    --
    -- Parallel framework: pthreads
    --
    -- Trace: YES (with Intel ITT)
    --
    -- Other third-party libraries:
    -- Lapack: NO
    -- Eigen: YES (ver 3.3.4)
    -- Custom HAL: NO
    -- Protobuf: build (3.5.1)
    --
    -- OpenCL: YES (no extra features)
    -- Include path: /home/simkslv/opencv/opencv-3.4.5/3rdparty/include/opencl/1.2
    -- Link libraries: Dynamic load
    --
    -- Python 3:
    -- Interpreter: /usr/bin/python3 (ver 3.6.9)
    -- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.6m.so (ver 3.6.9)
    -- numpy: /home/simkslv/.local/lib/python3.6/site-packages/numpy/core/include (ver 1.18.1)
    -- install path: lib/python3.6/dist-packages/cv2/python-3.6
    --
    -- Python (for build): /usr/bin/python2.7
    --
    -- Java:
    -- ant: NO
    -- JNI: NO
    -- Java wrappers: NO
    -- Java tests: NO
    --
    -- Install to: /usr/local
    -- -----------------------------------------------------------------
    --
    -- Configuring incomplete, errors occurred!
    See also "/home/simkslv/opencv/opencv-3.4.5/build/CMakeFiles/CMakeOutput.log".
    See also "/home/simkslv/opencv/opencv-3.4.5/build/CMakeFiles/CMakeError.log"

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.02.14 08:48 신고

      ENABLE_NEON 옵션이 활성화 되어서 에러가 나는 듯합니다. 입력하신 명령어에는 안보이는데 이상하군요. -D ENABLE_NEON=OFF를 추가해보세요.

  20. Favicon of https://kook1932.tistory.com BlogIcon 빠긔 2020.02.17 12:13 신고

    안녕하세요 글을 잘 포스팅해주신 덕분에 어떻게 설치해야하는지 알게 되었습니다.

    하지만 진행하다가 문제점이 생겼는데

    [99%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
    이 단계에서 넘어가질 않습니다. ㅠㅠ 분명 cmake 명령어도 똑같이하고
    python-dev python3-dev 도 설치하였는데 이 단계에서만 멈춤니다 ㅠㅠ 어떤 문제점이 있는 걸까요 ㅠㅠ

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.02.17 12:17 신고

      오래.걸리는 거 일수 있으니 기다려보세요

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.02.17 12:17 신고

      원래 오래.걸리는 부분입니다

    • Favicon of https://kook1932.tistory.com BlogIcon 빠긔 2020.02.17 16:44 신고

      아무리 기다려도 이 단계에서 진행되지 않고 있다가 심지어 putty가 멈춤현상이 발생합니다ㅠ 이게 단계가 유발하는 건지 아님 네트워크가 불안정해서 그런건진 잘 모르겠습니다..ㅠ 혹시 build중 python.h를 못찾는건 아닌건가요? 구글링해봐도 잘 안나와 해결하기 어렵네요..

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.02.17 19:40 신고

      혹시 j4같은 옵션을 주었다면 빼고 make만 사용해보세요. 혹시 PC가 아닌 다른 환경인가요?

    • Favicon of https://kook1932.tistory.com BlogIcon 빠긔 2020.02.19 09:50 신고

      말씀대로 make 명령만 하니 멈춤현상은 해결되었고 왜 안됐는지 에러 메세지를 받을 수 있었습니다. 기존에 aws ec2 프리 티어의 메모리 용량이 1GB였기 때문에 메모리 할당문제로 진행이 안됐던거 같습니다. 따라서 용량을 늘려주었고 마침네 make작업을 완료하였습니다!
      하지만 여기서 또다른 문제가 발생하였는데 샘플 코드를 실행시켜보고자 글에 나와있는데로 명령어를 입력하였는데
      dev/video0 이 없다는 에러 메세지가 출력됩니다. 다음 글인 ubuntu 18.04에 opencv 설치하기에 나와있는 저와 비슷한 경우의 댓글이 있어서 참고하여 facedetect.py까지 수정하였으나 그 분과 마찬가지로 같은 에러가 뜹니다 ㅠㅠ. 서버 환경은 로컬 pc가 아닌 azure cloud에 ubunt16.04를 설치하여 쓰고 있습니다. 그리고 웹캠은 노트북 내장 웹캠을 쓰고 있습니다. 왜 인식이 안되는지 너무 궁금합니다ㅠㅠ

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.02.19 19:41 신고

      클라우드에서 웹캠을 인식했는지 테스트해보셨나요? 보통 인식이되면 dev 디렉토리에 video0같은 파일이 생성됩니다

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.02.19 19:41 신고

      클라우드에서 웹캠을 인식했는지 테스트해보셨나요? 보통 인식이되면 dev 디렉토리에 video0같은 파일이 생성됩니다

    • Favicon of https://kook1932.tistory.com BlogIcon 빠긔 2020.02.20 09:42 신고

      아무래도 클라우드에서 제 노트북 웹캠을 인식하지 못하는거 같습니다. cheese를 사용해보았는데 no device가 뜨네요 ㅠㅠ
      혹시 클라우드 서버가 제 노트북 웹캠을 인식하도록 할 수 있는 방법이 있을까요? virtual machine같은 가상환경에서 인식하는 글은 많이 봤는데 클라우드 환경에서 웹캠을 인식하도록 하는 방법이 잘 안나오네요 ㅠㅠ 문제에 관심 가져주셔서 감사합니다.

    • Favicon of https://webnautes.tistory.com BlogIcon webnautes 2020.02.20 09:46 신고

      웹캠을 스트리밍해서 서버에서 Ip주소로 접근하게 해야할듯합니다.

      예를 들어 아래처럼요

      https://webnautes.tistory.com/1261

      https://webnautes.tistory.com/1262

  21. human 2020.04.23 15:08

    환경 : ubuntu 16.04

    libEGL.so 를 못찾는 에러 발생시

    sudo rm /usr/lib/x86_64-linux-gnu/libEGL.so; sudo ln /usr/lib/x86_64-linux-gnu/libEGL.so.1 /usr/lib/x86_64-linux-gnu/libEGL.so;

    위 커멘드 적용해주면 해결가능!

+ Recent posts