OpenCV 3.4.1과 opencv_contrib(extra modules)를 컴파일하여 Raspberry Pi 3에 설치하는 방법을 다룹니다.


2018년 4월 18일에 릴리즈된 Raspbian 이미지를 사용했습니다.

OpenCV를 컴파일하기 위해서는 최소 16G Micro SD 카드를 사용해야 합니다.


제가 라즈비안 초기 이미지부터 진행해서 검증하기 때문에 상황이 다른 경우에는 모두  대처하기가 힘든 점을 감안해주세요.



1. OpenCV 2.4 버전 제거

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

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

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

5. OpenCV 설치 결과 확인

   5.1. C/C++

   5.2. Python


관련 포스팅


Raspberry Pi 3 사용하는 방법(마이크로 SD 카드에 라즈비안 라이팅, ssh 설정 및 접속방법, raspi-config 설정 방법)

http://webnautes.tistory.com/899  


마이크로 SD 카드에 라즈비안(RASPBIAN) 이미지 파일을 라이팅(writing)하고  SSH 접속을 위해 필요한 작업과 사용하기 전에 꼭 해줘야 하는 설정을 다룹니다.



최종 업데이트 2018. 6. 25




1. OpenCV 2.4 버전 제거

1-1. OpenCV 2.4대 버전이 설치되어 있으면 새로 설치하는 OpenCV 3.4 버전이 제대로 동작하지 않기 때문에 제거해주어야 합니다.




1-2. 아래처럼 보이면 OpenCV 2.4대 버전이 설치안되어 있는 상태입니다.

다음 단계로 넘어가도  됩니다.


pi@raspberrypi:~ $ 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 버전이 출력됩니다.

pi@raspberrypi:~ $  pkg-config --modversion opencv
2.4.9.1



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

pi@raspberrypi:~ $ sudo apt-get purge  libopencv* python-opencv
pi@raspberrypi:~ $ sudo apt-get autoremove




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

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

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




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

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


pi@raspberrypi:~ $ sudo apt-get update




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


pi@raspberrypi:~ $ sudo apt-get upgrade




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

3-1. 일부 패키지는 배포된 Raspbian 이미지에 이미 포함되어 있는 경우도 있습니다.

또는 다른 패키지 설치시 같이 설치되기도 하지만 필요한 패키지들이라 언급하도록 하겠습니다.


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




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

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


$ sudo apt-get install build-essential cmake




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


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

$ sudo apt-get install pkg-config




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

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




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

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




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

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




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

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




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


윈도우 생성 등의 GUI를 위해 gtk 또는 qt를 선택해서 사용가능합니다.  여기서는 gtk2를 지정해주었습니다.

$ sudo apt-get install libgtk2.0-dev



그외 선택 가능한 패키지는 다음과 같습니다.

libgtk-3-dev

libqt4-dev

libqt5-dev




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

$ sudo apt-get install mesa-utils libgl1-mesa-dri libgtkgl2.0-dev libgtkglext1-dev   




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

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




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

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

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





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

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


pi@raspberrypi:~ $ mkdir opencv
pi@raspberrypi:~ $ cd opencv
pi@raspberrypi:~/opencv $




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

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




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

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

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




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


pi@raspberrypi:~/opencv $  ls -d */

opencv-3.4.1  opencv_contrib-3.4.1




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

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


pi@raspberrypi:~/opencv $  cd opencv-3.4.1

pi@raspberrypi:~/opencv/opencv-3.4.1 $  mkdir build

pi@raspberrypi:~/opencv/opencv-3.4.1 $  cd build

pi@raspberrypi:~/opencv/opencv-3.4.1/build $  




cmake를 사용하여 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 ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D WITH_QT=OFF \
-D WITH_GTK=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.1/modules \
-D WITH_V4L=ON \
-D WITH_FFMPEG=ON \
-D WITH_XINE=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
../



다음 처럼 cmake 실행 중에  추가적인 다운로드도 있으므로 라즈베리파이에 인터넷이 연결된 상태에서 진행하세요..



-- 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

-- xfeatures2d/vgg: Download: vgg_generated_48.i

-- xfeatures2d/vgg: Download: vgg_generated_64.i

-- xfeatures2d/vgg: Download: vgg_generated_80.i

-- xfeatures2d/vgg: Download: vgg_generated_120.i

-- data: Download: face_landmark_model.dat





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


-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/opencv/opencv-3.4.1/build



설정한 결과입니다.


-- General configuration for OpenCV 3.4.1 =====================================
--   Version control:               unknown
--
--   Extra modules:
--     Location (extra):            /home/pi/opencv/opencv_contrib-3.4.1/modules
--     Version control (extra):     unknown
--
--   Platform:
--     Timestamp:                   2018-06-24T17:00:34Z
--     Host:                      Linux 4.14.34-v7+ armv7l
--     CMake:                      3.7.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/make
--     Configuration:               RELEASE
--
--   CPU/HW features:
--     Baseline:                    VFPV3 NEON
--       requested:                 DETECT
--       required:                  VFPV3 NEON
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++11:                       YES
--     C++ Compiler:                /usr/bin/c++  (ver 6.3.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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfpu=neon -mfp16-format=ieee -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfpu=neon -mfp16-format=ieee -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfpu=neon -mfp16-format=ieee -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -mfpu=neon -mfp16-format=ieee -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/arm-linux-gnueabihf/libGLU.so /usr/lib/arm-linux-gnueabihf/libGL.so
--     3rdparty dependencies:
--
--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dpm face features2d flann freetype fuzzy 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:                    js world
--     Disabled by dependency:      -
--     Unavailable:                 cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv dnn_modern hdf java matlab ovis sfm ts viz
--     Applications:                apps
--     Documentation:               NO
--     Non-free algorithms:         NO
--
--   GUI:
--     GTK+:                        YES (ver 2.24.31)
--       GThread :                  YES (ver 2.50.3)
--       GtkGlExt:                  YES (ver 1.2.0)
--     OpenGL support:              YES (/usr/lib/arm-linux-gnueabihf/libGLU.so /usr/lib/arm-linux-gnueabihf/libGL.so)
--     VTK support:                 NO
--
--   Media I/O:
--     ZLib:                      /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
--     JPEG:                      /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver )
--     WEBP:                      build (ver encoder: 0x020e)
--     PNG:                      /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.28)
--     TIFF:                      /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 / 4.0.8)
--     JPEG 2000:                   /usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
--
--   Video I/O:
--     FFMPEG:                      YES
--       avcodec:                  YES (ver 57.64.101)
--       avformat:                  YES (ver 57.56.101)
--       avutil:                  YES (ver 55.34.101)
--       swscale:                  YES (ver 4.2.100)
--       avresample:                NO
--     GStreamer:
--       base:                  YES (ver 1.10.4)
--       video:                  YES (ver 1.10.4)
--       app:                  YES (ver 1.10.4)
--       riff:                  YES (ver 1.10.4)
--       pbutils:                  YES (ver 1.10.4)
--     libv4l/libv4l2:              NO
--     v4l/v4l2:                    linux/videodev2.h
--     Xine:                      YES (ver 1.2.6)
--     gPhoto2:                     NO
--
--   Parallel framework:            pthreads
--
--   Trace:                         YES (built-in)
--
--   Other third-party libraries:
--     Lapack:                      NO
--     Eigen:                      YES (ver 3.3.2)
--     Custom HAL:                  YES (carotene (ver 0.0.1))
--     Protobuf:                    build (3.5.1)
--
--   NVIDIA CUDA:                   NO
--
--   OpenCL:                        YES (no extra features)
--     Include path:                /home/pi/opencv/opencv-3.4.1/3rdparty/include/opencl/1.2
--     Link libraries:              Dynamic load
--
--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.13)
--     Libraries:                   /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.13)
--     numpy:                      /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.12.1)
--     packages path:               lib/python2.7/dist-packages
--
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.5.3)
--     Libraries:                   /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (ver 3.5.3)
--     numpy:                      /usr/lib/python3/dist-packages/numpy/core/include (ver 1.12.1)
--     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:                        NO
--
--   Install to:                    /usr/local
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/opencv/opencv-3.4.1/build




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


--   Python 2:
--     Interpreter:                 /usr/bin/python2.7 (ver 2.7.13)
--     Libraries:                   /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.13)
--     numpy:                      /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.12.1)
--     packages path:               lib/python2.7/dist-packages
--
--   Python 3:
--     Interpreter:                 /usr/bin/python3 (ver 3.5.3)
--     Libraries:                   /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (ver 3.5.3)
--     numpy:                      /usr/lib/python3/dist-packages/numpy/core/include (ver 1.12.1)
--     packages path:               lib/python3.5/dist-packages
--
--   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 ENABLE_NEON=ON \

-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=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/arm-linux-gnueabihf/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.5/dist-packages \

-D PYTHON3_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.5m.so \

../




진행하기 전에 스왑(swap) 공간을 늘려줘야 멀티코어를 사용하여 컴파일시에 메모리 부족으로 에러가 나지 않습니다.

( 참고 https://www.pyimagesearch.com/2017/10/09/optimizing-opencv-on-the-raspberry-pi/ )



/etc/dphys-swapfile 파일을 열어서


$ sudo nano /etc/dphys-swapfile



CONF_SWAPSIZE  변수값을 1024로 수정합니다.


# set size to absolute value, leaving empty (default) then uses computed value
#   you most likely don't want this, unless you have an special disk situation
# CONF_SWAPSIZE=100
CONF_SWAPSIZE=1024



스왑 서비스 재시작하여 변경된 설정을 반영시켜주면 스왑 크기가 대략 10배가 됩니다.


pi@raspberrypi:~/opencv/opencv-3.4.1/build $ free
             total used        free shared buff/cache   available
Mem:         896672 79656       64716 11840 752300      739640
Swap:        102396           0      102396
pi@raspberrypi:~/opencv/opencv-3.4.1/build $ sudo /etc/init.d/dphys-swapfile restart
[ ok ] Restarting dphys-swapfile (via systemctl): dphys-swapfile.service.
pi@raspberrypi:~/opencv/opencv-3.4.1/build $ free
             total used        free shared buff/cache   available
Mem:         896672 80128       61304 11840 755240      739168
Swap:       1048572           0     1048572



이제 make 명령을 사용하여 컴파일을 시작합니다.


pi@raspberrypi:~/opencv/opencv-3.4.1/build $ make -j4




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


pi@raspberrypi:~/opencv/opencv-3.4.1/build $ sudo make install



샘플 코드들은 /usr/local/share/OpenCV/samples/ 위치에 복사됩니다.



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

pi@raspberrypi:~/opencv/opencv-3.4.1/build $ cat /etc/ld.so.conf.d/*
/opt/vc/lib
# Multiarch support
/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabihf
/usr/lib/arm-linux-gnueabihf/libfakeroot
# libc default configuration
/usr/local/lib




/usr/local/lib이 출력되지 않았다면 다음 명령을 수행합니다.

pi@raspberrypi:~/opencv/opencv-3.4.1/build $ sudo sh -c 'echo '/usr/local/lib' > /etc/ld.so.conf.d/opencv.conf'




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

pi@raspberrypi:~/opencv/opencv-3.4.1/build $ sudo ldconfig




/etc/dphys-swapfile 파일을 열어서


$ sudo nano /etc/dphys-swapfile



CONF_SWAPSIZE  변수값을 다시 100으로 수정합니다.


# set size to absolute value, leaving empty (default) then uses computed value
#   you most likely don't want this, unless you have an special disk situation
CONF_SWAPSIZE=100
#CONF_SWAPSIZE=1024



스왑 서비스 재시작하여 변경된 설정을 반영시켜주면 스왑 크기가 원래대로 돌아옵니다.


pi@raspberrypi:~/opencv/opencv-3.4.1/build $ sudo /etc/init.d/dphys-swapfile restart
[ ok ] Restarting dphys-swapfile (via systemctl): dphys-swapfile.service.


pi@raspberrypi:~/opencv/opencv-3.4.1/build $ free
             total used        free shared buff/cache   available
Mem:         896672 85660      220784 22084 590228      725888
Swap:        102396           0      102396




5. OpenCV 설치 결과 확인

5.1. C/C++

C/C++를 위해 OpenCV 라이브러리 사용가능 여부를 확인합니다.

문제 없으면 설치된 OpenCV 라이브러리의 버전이 출력됩니다.


pi@raspberrypi:~/opencv/opencv-3.4.1/build $  pkg-config --modversion opencv
3.4.0



아래처럼 opencv를 찾을 수 없다고 나오면  추가 작업이 필요합니다.


pi@raspberrypi:~/opencv/opencv-3.4.1/build $  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




pkg-config 명령이 /usr/local/lib/pkgconfig 경로에 있는 opencv.pc 파일을 찾을 수 있도록 해줘야 합니다.


$ sudo sh -c 'echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig >> /etc/bash.bashrc'
$ sudo sh -c 'echo export PKG_CONFIG_PATH >> /etc/bash.bashrc'



로그아웃했다가 로그인하면 적용이됩니다.



다시 확인했을 때,  OpenCV 버전이 나와야 합니다.


pi@raspberrypi:~/opencv/opencv-3.4.1/build $ pkg-config --modversion opencv
3.4.1




pkg-config --libs --cflags opencv 명령을 실행했을 때 다음처럼 나오면 문제없이 설치가 완료된 것입니다.


pi@raspberrypi:~/opencv/opencv-3.4.1/build $ pkg-config --libs --cflags opencv
-I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dpm -lopencv_face -lopencv_photo -lopencv_freetype -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ml -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_flann -lopencv_xobjdetect -lopencv_imgcodecs -lopencv_objdetect -lopencv_xphoto -lopencv_imgproc -lopencv_core


.


예제 코드를 하나 가져와서 컴파일 해보겠습니다.


$ cp /usr/local/share/OpenCV/samples/cpp/facedetect.cpp ./




테스트를 하기 위해  필요한 웹캠 또는 Raspberry Pi Camera(pi camera)를  Raspberry Pi에 먼저 연결합니다.


대부분의 웹캠은 연결후 dmesg | tail 명령어로 해당 웹캠을 확인시 다음처럼 문제 없이 인식이 됩니다.

인식이 안되면 해당 웹캠을 위한 디바이스 드라이버를 설치해줘야 합니다.




/dev/video0 디바이스 파일이 생성되었는지 확인해봅니다.




파이 카메라의 경우에는 아래 포스팅을 참고하세요.


Raspberry Pi Camera Module( pi camera )를 위해 /dev/video0 생성하는 방법

http://webnautes.tistory.com/1192



이제 컴파일 후, 실행시켜 봅니다.


$ g++ -o facedetect facedetect.cpp $(pkg-config --libs --cflags opencv)  

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




터미널 프로그램으로 MobaXterm을 사용하면 SSH 접속 후, 바로 실행 결과를 확인 가능합니다.

(일종의 VNC처럼 동작해서 속도는 느립니다..)


https://mobaxterm.mobatek.net/




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


pi@raspberrypi:~/opencv/opencv-3.4.1/build $  ./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_eye_tree_eyeglasses.xml " --scale=1.3
Video capturing has been started ...
[ INFO:0] Initialize OpenCL runtime...
detection time = 317.549 ms
detection time = 292.267 ms
detection time = 285.393 ms
detection time = 287.672 ms
detection time = 291.738 ms
detection time = 336.075 ms
detection time = 297.108




5.2. Python

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

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

pi@raspberrypi:~/opencv/opencv-3.4.0/build $ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.4.0'
>>>


pi@raspberrypi:~/opencv/opencv-3.4.0/build $ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.4.0'
>>>




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


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


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




카메라 영상에 얼굴이 검출된 결과를 얻을 수 있습니다.


pi@raspberrypi:~/opencv/opencv-3.4.0/build $ python /usr/local/share/OpenCV/samples/python/facedetect.py --cascade "/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade "/usr/local/share/OpenCV/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...




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


pi@raspberrypi:~/opencv/opencv-3.4.1/build $ cd
pi@raspberrypi:~ $ rm -rf opencv




  1. 이전 댓글 더보기
  2. hmshim 2018.03.30 08:12 신고

    pi@raspberrypi:~/opencv/opencv-3.4.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_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_INCLUDE_DIR2=/usr/include/arm-linux-gnueabihf/python2.7 \
    > -D PYTHON2_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython2.7.so \
    > -D PYTHON3_INCLUDE_DIR=/usr/include/python3.5m \
    > -D PYTHON3_INCLUDE_DIR2=/usr/include/arm-linux-gnueabihf/python3.5m \
    > -D PYTHON3_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.5m.so \
    > ../
    -- Looking for ccache - not found
    -- FP16 is not supported by C++ compiler
    CMake Error at cmake/OpenCVCompilerOptimizations.cmake:412 (message):
    Required baseline optimization is not supported: NEON
    (CPU_BASELINE_REQUIRE=;NEON)
    Call Stack (most recent call first):
    cmake/OpenCVCompilerOptions.cmake:259 (include)
    CMakeLists.txt:526 (include)


    -- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
    -- Found ZLIB: /usr/lib/arm-linux-gnueabihf/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:601 (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:601 (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:601 (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:601 (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:601 (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 'libavresample'
    -- No package 'libavresample' found
    -- Checking for module 'libgphoto2'
    -- No package 'libgphoto2' found
    -- 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 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
    -- Looking for tiny_dnn.h
    -- Looking for tiny_dnn.h - found
    -- Found tiny-dnn in: /home/pi/opencv/opencv-3.4.0/build/3rdparty/tinydnn/tiny-dnn-1.0.0a3
    -- The protocol buffer compiler is not found (PROTOBUF_PROTOC_EXECUTABLE='')
    -- freetype2: YES
    -- harfbuzz: YES
    -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
    -- 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
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/core/src/convert.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/core/src/convert.fp16.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/core/src/convert.sse4_1.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/mathfuncs_core.sse2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/mathfuncs_core.avx.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/mathfuncs_core.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/stat.sse4_2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/stat.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/corner.avx.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/filter.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/imgwarp.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/imgwarp.sse4_1.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/resize.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/resize.sse4_1.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/undistort.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/imgproc/accum.sse2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/imgproc/accum.avx.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/imgproc/accum.neon.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/objdetect/src/haar.avx.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/dnn/layers/layers_common.avx.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/dnn/layers/layers_common.avx2.cpp
    -- freetype2: YES
    -- harfbuzz: YES
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/features2d/src/fast.avx2.cpp
    -- Checking for modules 'tesseract;lept'
    -- No package 'tesseract' found
    -- No package 'lept' found
    -- Tesseract: NO
    --
    -- General configuration for OpenCV 3.4.0 =====================================
    -- Version control: unknown
    --
    -- Extra modules:
    -- Location (extra): /home/pi/opencv/opencv_contrib-3.4.0/modules
    -- Version control (extra): unknown
    --
    -- Platform:
    -- Timestamp: 2018-03-20T11:39:06Z
    -- Host: Linux 4.9.80-v7+ armv7l
    -- CMake: 3.7.2
    -- CMake generator: Unix Makefiles
    -- CMake build tool: /usr/bin/make
    -- Configuration: RELEASE
    --
    -- CPU/HW features:
    -- Baseline:
    -- requested: DETECT
    -- required: NEON
    -- disabled: VFPV3 NEON
    --
    -- C/C++:
    -- Built as dynamic libs?: YES
    -- C++11: YES
    -- C++ Compiler: /usr/bin/c++ (ver 6.3.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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfp16-format=ieee -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/arm-linux-gnueabihf/libGLU.so /usr/lib/arm-linux-gnueabihf/libGL.so
    -- 3rdparty dependencies:
    --
    -- OpenCV modules:
    -- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dpm face features2d flann freetype fuzzy highgui img_hash imgcodecs imgproc 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 ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
    -- Disabled: js world
    -- Disabled by dependency: -
    -- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv dnn_modern hdf java matlab ovis sfm viz
    -- Applications: apps
    -- Documentation: NO
    -- Non-free algorithms: NO
    --
    -- GUI:
    -- QT: YES (ver 4.8.7 EDITION = OpenSource)
    -- QT OpenGL support: YES (/usr/lib/arm-linux-gnueabihf/libQtOpenGL.so)
    -- GTK+: NO
    -- OpenGL support: YES (/usr/lib/arm-linux-gnueabihf/libGLU.so /usr/lib/arm-linux-gnueabihf/libGL.so)
    -- VTK support: NO
    --
    -- Media I/O:
    -- ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
    -- JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver )
    -- WEBP: build (ver encoder: 0x020e)
    -- PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.28)
    -- TIFF: /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 / 4.0.8)
    -- JPEG 2000: /usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1)
    -- OpenEXR: build (ver 1.7.1)
    --
    -- Video I/O:
    -- FFMPEG: YES
    -- avcodec: YES (ver 57.64.101)
    -- avformat: YES (ver 57.56.101)
    -- avutil: YES (ver 55.34.101)
    -- swscale: YES (ver 4.2.100)
    -- avresample: NO
    -- GStreamer:
    -- base: YES (ver 1.10.4)
    -- video: YES (ver 1.10.4)
    -- app: YES (ver 1.10.4)
    -- riff: YES (ver 1.10.4)
    -- pbutils: YES (ver 1.10.4)
    -- libv4l/libv4l2: NO
    -- v4l/v4l2: linux/videodev2.h
    -- Xine: YES (ver 1.2.6)
    -- gPhoto2: NO
    --
    -- Parallel framework: pthreads
    --
    -- Trace: YES (built-in)
    --
    -- Other third-party libraries:
    -- Lapack: NO
    -- Eigen: YES (ver 3.3.2)
    -- Custom HAL: YES (carotene (ver 0.0.1))
    --
    -- NVIDIA CUDA: NO
    --
    -- OpenCL: YES (no extra features)
    -- Include path: /home/pi/opencv/opencv-3.4.0/3rdparty/include/opencl/1.2
    -- Link libraries: Dynamic load
    --
    -- Python 2:
    -- Interpreter: /usr/bin/python2.7 (ver 2.7.13)
    -- Libraries: /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.13)
    -- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include/ (ver 1.12.1)
    -- packages path: /usr/lib/python2.7/dist-packages
    --
    -- Python 3:
    -- Interpreter: /usr/bin/python3 (ver 3.5.3)
    -- Libraries: /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (ver 3.5.3)
    -- numpy: /usr/lib/python3/dist-packages/numpy/core/include/ (ver 1.12.1)
    -- packages path: /usr/lib/python3.5/dist-packages
    --
    -- Python (for build): /usr/bin/python2.7
    --
    -- Java:
    -- ant: NO
    -- JNI: NO
    -- Java wrappers: NO
    -- Java tests: NO
    --
    -- Matlab: NO
    --
    -- Install to: /usr/local
    -- -----------------------------------------------------------------
    --
    -- Configuring incomplete, errors occurred!
    See also "/home/pi/opencv/opencv-3.4.0/build/CMakeFiles/CMakeOutput.log".
    See also "/home/pi/opencv/opencv-3.4.0/build/CMakeFiles/CMakeError.log".

  3. hmshim 2018.03.30 08:14 신고

    위쪽 전체 결과입니다.

  4. hmshim 2018.03.30 10:15 신고

    Success........
    build folder delete......... remake...

    pi@raspberrypi:~/opencv/opencv-3.4.0/build $ cd ..
    pi@raspberrypi:~/opencv/opencv-3.4.0 $ rm -r build
    pi@raspberrypi:~/opencv/opencv-3.4.0 $ ls
    3rdparty CONTRIBUTING.md README.md cmake doc modules samples
    CMakeLists.txt LICENSE apps data include platforms
    pi@raspberrypi:~/opencv/opencv-3.4.0 $ cd build
    bash: cd: build: 그런 파일이나 디렉터리가 없습니다
    pi@raspberrypi:~/opencv/opencv-3.4.0 $ mkdir build
    pi@raspberrypi:~/opencv/opencv-3.4.0 $ cd build
    pi@raspberrypi:~/opencv/opencv-3.4.0/build $
    pi@raspberrypi:~/opencv/opencv-3.4.0/build $
    pi@raspberrypi:~/opencv/opencv-3.4.0/build $
    pi@raspberrypi:~/opencv/opencv-3.4.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 ENABLE_NEON=ON \
    > -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=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/arm-linux-gnueabihf/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.5/dist-packages \
    > -D PYTHON3_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.5m.so \
    > ../
    -- The CXX compiler identification is GNU 6.3.0
    -- The C compiler identification is GNU 6.3.0
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Performing Test HAVE_CXX11 (check file: cmake/checks/cxx11.cpp)
    -- Performing Test HAVE_CXX11 - Success
    -- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.13", minimum required is "2.7")
    -- Found PythonLibs: /usr/lib/arm-linux-gnueabihf/libpython2.7.so (found suitable exact version "2.7.13")
    -- Found PythonInterp: /usr/bin/python3 (found suitable version "3.5.3", minimum required is "3.4")
    -- Found PythonLibs: /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (found suitable exact version "3.5.3")
    -- Looking for ccache - not found
    -- Performing Test HAVE_CXX_FSIGNED_CHAR
    -- Performing Test HAVE_CXX_FSIGNED_CHAR - Success
    -- Performing Test HAVE_C_FSIGNED_CHAR
    -- Performing Test HAVE_C_FSIGNED_CHAR - Success
    -- Performing Test HAVE_CXX_W
    -- Performing Test HAVE_CXX_W - Success
    -- Performing Test HAVE_C_W
    -- Performing Test HAVE_C_W - Success
    -- Performing Test HAVE_CXX_WALL
    -- Performing Test HAVE_CXX_WALL - Success
    -- Performing Test HAVE_C_WALL
    -- Performing Test HAVE_C_WALL - Success
    -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE
    -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success
    -- Performing Test HAVE_C_WERROR_RETURN_TYPE
    -- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success
    -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR
    -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR - Success
    -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR
    -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR - Success
    -- Performing Test HAVE_CXX_WERROR_ADDRESS
    -- Performing Test HAVE_CXX_WERROR_ADDRESS - Success
    -- Performing Test HAVE_C_WERROR_ADDRESS
    -- Performing Test HAVE_C_WERROR_ADDRESS - Success
    -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT
    -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT - Success
    -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT
    -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success
    -- Performing Test HAVE_CXX_WFORMAT
    -- Performing Test HAVE_CXX_WFORMAT - Success
    -- Performing Test HAVE_C_WFORMAT
    -- Performing Test HAVE_C_WFORMAT - Success
    -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY
    -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY - Success
    -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY
    -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY - Success
    -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS
    -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS - Success
    -- Performing Test HAVE_C_WMISSING_DECLARATIONS
    -- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success
    -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES
    -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed
    -- Performing Test HAVE_C_WMISSING_PROTOTYPES
    -- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success
    -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES
    -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed
    -- Performing Test HAVE_C_WSTRICT_PROTOTYPES
    -- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success
    -- Performing Test HAVE_CXX_WUNDEF
    -- Performing Test HAVE_CXX_WUNDEF - Success
    -- Performing Test HAVE_C_WUNDEF
    -- Performing Test HAVE_C_WUNDEF - Success
    -- Performing Test HAVE_CXX_WINIT_SELF
    -- Performing Test HAVE_CXX_WINIT_SELF - Success
    -- Performing Test HAVE_C_WINIT_SELF
    -- Performing Test HAVE_C_WINIT_SELF - Success
    -- Performing Test HAVE_CXX_WPOINTER_ARITH
    -- Performing Test HAVE_CXX_WPOINTER_ARITH - Success
    -- Performing Test HAVE_C_WPOINTER_ARITH
    -- Performing Test HAVE_C_WPOINTER_ARITH - Success
    -- Performing Test HAVE_CXX_WSHADOW
    -- Performing Test HAVE_CXX_WSHADOW - Success
    -- Performing Test HAVE_C_WSHADOW
    -- Performing Test HAVE_C_WSHADOW - Success
    -- Performing Test HAVE_CXX_WSIGN_PROMO
    -- Performing Test HAVE_CXX_WSIGN_PROMO - Success
    -- Performing Test HAVE_C_WSIGN_PROMO
    -- Performing Test HAVE_C_WSIGN_PROMO - Failed
    -- Performing Test HAVE_CXX_WUNINITIALIZED
    -- Performing Test HAVE_CXX_WUNINITIALIZED - Success
    -- Performing Test HAVE_C_WUNINITIALIZED
    -- Performing Test HAVE_C_WUNINITIALIZED - Success
    -- Performing Test HAVE_CXX_WNO_NARROWING
    -- Performing Test HAVE_CXX_WNO_NARROWING - Success
    -- Performing Test HAVE_C_WNO_NARROWING
    -- Performing Test HAVE_C_WNO_NARROWING - Success
    -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR
    -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR - Success
    -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR
    -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR - Failed
    -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
    -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
    -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
    -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Failed
    -- Performing Test HAVE_CXX_WNO_COMMENT
    -- Performing Test HAVE_CXX_WNO_COMMENT - Success
    -- Performing Test HAVE_C_WNO_COMMENT
    -- Performing Test HAVE_C_WNO_COMMENT - Success
    -- Performing Test HAVE_CXX_WNO_IMPLICIT_FALLTHROUGH
    -- Performing Test HAVE_CXX_WNO_IMPLICIT_FALLTHROUGH - Failed
    -- Performing Test HAVE_C_WNO_IMPLICIT_FALLTHROUGH
    -- Performing Test HAVE_C_WNO_IMPLICIT_FALLTHROUGH - Failed
    -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION
    -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION - Success
    -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION
    -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION - Success
    -- Performing Test HAVE_CXX_PTHREAD
    -- Performing Test HAVE_CXX_PTHREAD - Success
    -- Performing Test HAVE_C_PTHREAD
    -- Performing Test HAVE_C_PTHREAD - Success
    -- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER
    -- Performing Test HAVE_CXX_FOMIT_FRAME_POINTER - Success
    -- Performing Test HAVE_C_FOMIT_FRAME_POINTER
    -- Performing Test HAVE_C_FOMIT_FRAME_POINTER - Success
    -- Performing Test HAVE_CXX_FFUNCTION_SECTIONS
    -- Performing Test HAVE_CXX_FFUNCTION_SECTIONS - Success
    -- Performing Test HAVE_C_FFUNCTION_SECTIONS
    -- Performing Test HAVE_C_FFUNCTION_SECTIONS - Success
    -- Performing Test HAVE_CXX_FDATA_SECTIONS
    -- Performing Test HAVE_CXX_FDATA_SECTIONS - Success
    -- Performing Test HAVE_C_FDATA_SECTIONS
    -- Performing Test HAVE_C_FDATA_SECTIONS - Success
    -- Performing Test HAVE_CXX_MFPU_VFPV3
    -- Performing Test HAVE_CXX_MFPU_VFPV3 - Success
    -- Performing Test HAVE_CPU_NEON_SUPPORT (check file: cmake/checks/cpu_neon.cpp)
    -- Performing Test HAVE_CPU_NEON_SUPPORT - Failed
    -- Performing Test HAVE_CXX_MFPU_NEON (check file: cmake/checks/cpu_neon.cpp)
    -- Performing Test HAVE_CXX_MFPU_NEON - Success
    -- Performing Test HAVE_CPU_FP16_SUPPORT (check file: cmake/checks/cpu_fp16.cpp)
    -- Performing Test HAVE_CPU_FP16_SUPPORT - Failed
    -- Performing Test HAVE_CXX_MFPU_NEON_FP16 (check file: cmake/checks/cpu_fp16.cpp)
    -- Performing Test HAVE_CXX_MFPU_NEON_FP16 - Failed
    -- FP16 is not supported by C++ compiler
    -- Performing Test HAVE_CPU_BASELINE_FLAGS
    -- Performing Test HAVE_CPU_BASELINE_FLAGS - Success
    -- Performing Test HAVE_CXX_MFP16_FORMAT_IEEE
    -- Performing Test HAVE_CXX_MFP16_FORMAT_IEEE - Success
    -- Performing Test HAVE_C_MFP16_FORMAT_IEEE
    -- Performing Test HAVE_C_MFP16_FORMAT_IEEE - Success
    -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN
    -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN - Success
    -- Performing Test HAVE_C_FVISIBILITY_HIDDEN
    -- Performing Test HAVE_C_FVISIBILITY_HIDDEN - Success
    -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN
    -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN - Success
    -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN
    -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN - Failed
    -- Looking for pthread.h
    -- Looking for pthread.h - found
    -- Looking for posix_memalign
    -- Looking for posix_memalign - found
    -- Looking for malloc.h
    -- Looking for malloc.h - found
    -- Looking for memalign
    -- Looking for memalign - found
    -- Check if the system is big endian
    -- Searching 16 bit integer
    -- Looking for sys/types.h
    -- Looking for sys/types.h - found
    -- Looking for stdint.h
    -- Looking for stdint.h - found
    -- Looking for stddef.h
    -- Looking for stddef.h - found
    -- Check size of unsigned short
    -- Check size of unsigned short - done
    -- Using unsigned short
    -- Check if the system is big endian - little endian
    -- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found suitable version "1.2.8", minimum required is "1.2.3")
    -- Found JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so
    -- Found TIFF: /usr/lib/arm-linux-gnueabihf/libtiff.so (found version "4.0.8")
    -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE
    -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE - Success
    -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION
    -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION - Success
    -- Performing Test HAVE_C_WNO_SHADOW
    -- Performing Test HAVE_C_WNO_SHADOW - Success
    -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED
    -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED - Success
    -- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES
    -- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES - Success
    -- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS
    -- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS - Success
    -- Found Jasper: /usr/lib/arm-linux-gnueabihf/libjasper.so (found version "1.900.1")
    -- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.2.8")
    -- Found PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (found version "1.6.28")
    -- Looking for /usr/include/libpng/png.h
    -- Looking for /usr/include/libpng/png.h - found
    -- Looking for semaphore.h
    -- Looking for semaphore.h - found
    -- Performing Test HAVE_CXX_WNO_SHADOW
    -- Performing Test HAVE_CXX_WNO_SHADOW - Success
    -- Performing Test HAVE_CXX_WNO_UNUSED
    -- Performing Test HAVE_CXX_WNO_UNUSED - Success
    -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE
    -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE - Success
    -- Performing Test HAVE_CXX_WNO_UNDEF
    -- Performing Test HAVE_CXX_WNO_UNDEF - Success
    -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS
    -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS - Success
    -- Performing Test HAVE_CXX_WNO_UNINITIALIZED
    -- Performing Test HAVE_CXX_WNO_UNINITIALIZED - Success
    -- Performing Test HAVE_CXX_WNO_SWITCH
    -- Performing Test HAVE_CXX_WNO_SWITCH - Success
    -- Performing Test HAVE_CXX_WNO_PARENTHESES
    -- Performing Test HAVE_CXX_WNO_PARENTHESES - Success
    -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS
    -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success
    -- Performing Test HAVE_CXX_WNO_EXTRA
    -- Performing Test HAVE_CXX_WNO_EXTRA - Success
    -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS
    -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS - Success
    -- Performing Test HAVE_CXX_WNO_MISLEADING_INDENTATION
    -- Performing Test HAVE_CXX_WNO_MISLEADING_INDENTATION - Success
    -- Performing Test HAVE_CXX_WNO_DEPRECATED
    -- Performing Test HAVE_CXX_WNO_DEPRECATED - Success
    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:601 (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:601 (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:601 (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:601 (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:601 (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 'gstreamer-base-1.0'
    -- Found gstreamer-base-1.0, version 1.10.4
    -- Checking for module 'gstreamer-video-1.0'
    -- Found gstreamer-video-1.0, version 1.10.4
    -- Checking for module 'gstreamer-app-1.0'
    -- Found gstreamer-app-1.0, version 1.10.4
    -- Checking for module 'gstreamer-riff-1.0'
    -- Found gstreamer-riff-1.0, version 1.10.4
    -- Checking for module 'gstreamer-pbutils-1.0'
    -- Found gstreamer-pbutils-1.0, version 1.10.4
    -- 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 modules 'libavcodec;libavformat;libavutil;libswscale'
    -- Found libavcodec, version 57.64.101
    -- Found libavformat, version 57.56.101
    -- Found libavutil, version 55.34.101
    -- Found libswscale, version 4.2.100
    -- Checking for module 'libavresample'
    -- No package 'libavresample' found
    -- Checking for module 'libgphoto2'
    -- No package 'libgphoto2' found
    -- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
    -- Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
    -- Looking for dgemm_
    -- Looking for dgemm_ - found
    -- Looking for pthread.h
    -- Looking for pthread.h - found
    -- Looking for pthread_create
    -- Looking for pthread_create - found
    -- Found Threads: TRUE
    -- A library with BLAS API found.
    -- Looking for cheev_
    -- Looking for cheev_ - 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 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
    -- Performing Test CXX_HAS_MFPU_NEON
    -- Performing Test CXX_HAS_MFPU_NEON - Success
    -- Performing Test C_HAS_MFPU_NEON
    -- Performing Test C_HAS_MFPU_NEON - Success
    -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES
    -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES - Failed
    -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER
    -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER - Success
    -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS
    -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS - Success
    -- Performing Test HAVE_CXX_WNO_SIGN_PROMO
    -- Performing Test HAVE_CXX_WNO_SIGN_PROMO - Success
    -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE
    -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE - Failed
    -- Performing Test HAVE_CXX_WNO_IGNORED_QUALIFIERS
    -- Performing Test HAVE_CXX_WNO_IGNORED_QUALIFIERS - Success
    -- Performing Test HAVE_CXX_WNO_UNUSED_FUNCTION
    -- Performing Test HAVE_CXX_WNO_UNUSED_FUNCTION - Success
    -- Performing Test HAVE_CXX_WNO_UNUSED_CONST_VARIABLE
    -- Performing Test HAVE_CXX_WNO_UNUSED_CONST_VARIABLE - Success
    -- Performing Test HAVE_CXX_WNO_SHORTEN_64_TO_32
    -- Performing Test HAVE_CXX_WNO_SHORTEN_64_TO_32 - Failed
    -- Caffe: NO
    -- Protobuf: NO
    -- Glog: NO
    -- tiny-dnn: Download: v1.0.0a3.tar.gz
    -- Looking for tiny_dnn.h
    -- Looking for tiny_dnn.h - found
    -- Found tiny-dnn in: /home/pi/opencv/opencv-3.4.0/build/3rdparty/tinydnn/tiny-dnn-1.0.0a3
    -- Performing Test COMPILER_SUPPORTS_CXX11
    -- Performing Test COMPILER_SUPPORTS_CXX11 - Success
    -- The protocol buffer compiler is not found (PROTOBUF_PROTOC_EXECUTABLE='')
    -- Checking for one of the modules 'freetype2'
    -- Checking for one of the modules 'harfbuzz'
    -- freetype2: YES
    -- harfbuzz: YES
    -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
    -- 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
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/core/src/convert.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/core/src/convert.fp16.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/core/src/convert.sse4_1.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/mathfuncs_core.sse2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/mathfuncs_core.avx.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/mathfuncs_core.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/stat.sse4_2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/core/stat.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/corner.avx.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/filter.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/imgwarp.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/imgwarp.sse4_1.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/resize.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/resize.sse4_1.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/imgproc/src/undistort.avx2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/imgproc/accum.sse2.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/imgproc/accum.avx.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/objdetect/src/haar.avx.cpp
    -- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED
    -- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED - Success
    -- Performing Test HAVE_CXX_WNO_ENUM_COMPARE
    -- Performing Test HAVE_CXX_WNO_ENUM_COMPARE - Success
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/dnn/layers/layers_common.avx.cpp
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/build/modules/dnn/layers/layers_common.avx2.cpp
    -- freetype2: YES
    -- harfbuzz: YES
    -- Excluding from source files list: /home/pi/opencv/opencv-3.4.0/modules/features2d/src/fast.avx2.cpp
    -- Performing Test HAVE_CXX_WNO_OVERLOADED_VIRTUAL
    -- Performing Test HAVE_CXX_WNO_OVERLOADED_VIRTUAL - Success
    -- Checking for modules 'tesseract;lept'
    -- No package 'tesseract' found
    -- No package 'lept' found
    -- Tesseract: NO
    -- 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
    -- xfeatures2d/vgg: Download: vgg_generated_48.i
    -- xfeatures2d/vgg: Download: vgg_generated_64.i
    -- xfeatures2d/vgg: Download: vgg_generated_80.i
    -- xfeatures2d/vgg: Download: vgg_generated_120.i
    -- data: Download: face_landmark_model.dat
    -- Performing Test HAVE_CXX_WNO_UNUSED_PRIVATE_FIELD
    -- Performing Test HAVE_CXX_WNO_UNUSED_PRIVATE_FIELD - Failed
    --
    -- General configuration for OpenCV 3.4.0 =====================================
    -- Version control: unknown
    --
    -- Extra modules:
    -- Location (extra): /home/pi/opencv/opencv_contrib-3.4.0/modules
    -- Version control (extra): unknown
    --
    -- Platform:
    -- Timestamp: 2018-03-30T01:13:19Z
    -- Host: Linux 4.14.30-v7+ armv7l
    -- CMake: 3.7.2
    -- CMake generator: Unix Makefiles
    -- CMake build tool: /usr/bin/make
    -- Configuration: RELEASE
    --
    -- CPU/HW features:
    -- Baseline: NEON
    -- requested: DETECT
    -- required: NEON
    -- disabled: VFPV3
    --
    -- C/C++:
    -- Built as dynamic libs?: YES
    -- C++11: YES
    -- C++ Compiler: /usr/bin/c++ (ver 6.3.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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfpu=neon -mfp16-format=ieee -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfpu=neon -mfp16-format=ieee -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfpu=neon -mfp16-format=ieee -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 -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -mfpu=neon -mfp16-format=ieee -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/arm-linux-gnueabihf/libGLU.so /usr/lib/arm-linux-gnueabihf/libGL.so
    -- 3rdparty dependencies:
    --
    -- OpenCV modules:
    -- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dpm face features2d flann freetype fuzzy highgui img_hash imgcodecs imgproc 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: js world
    -- Disabled by dependency: -
    -- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv dnn_modern hdf java matlab ovis sfm ts viz
    -- Applications: apps
    -- Documentation: NO
    -- Non-free algorithms: NO
    --
    -- GUI:
    -- QT: YES (ver 4.8.7 EDITION = OpenSource)
    -- QT OpenGL support: YES (/usr/lib/arm-linux-gnueabihf/libQtOpenGL.so)
    -- GTK+: NO
    -- OpenGL support: YES (/usr/lib/arm-linux-gnueabihf/libGLU.so /usr/lib/arm-linux-gnueabihf/libGL.so)
    -- VTK support: NO
    --
    -- Media I/O:
    -- ZLib: /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
    -- JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver )
    -- WEBP: build (ver encoder: 0x020e)
    -- PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.6.28)
    -- TIFF: /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 / 4.0.8)
    -- JPEG 2000: /usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1)
    -- OpenEXR: build (ver 1.7.1)
    --
    -- Video I/O:
    -- FFMPEG: YES
    -- avcodec: YES (ver 57.64.101)
    -- avformat: YES (ver 57.56.101)
    -- avutil: YES (ver 55.34.101)
    -- swscale: YES (ver 4.2.100)
    -- avresample: NO
    -- GStreamer:
    -- base: YES (ver 1.10.4)
    -- video: YES (ver 1.10.4)
    -- app: YES (ver 1.10.4)
    -- riff: YES (ver 1.10.4)
    -- pbutils: YES (ver 1.10.4)
    -- libv4l/libv4l2: NO
    -- v4l/v4l2: linux/videodev2.h
    -- Xine: YES (ver 1.2.6)
    -- gPhoto2: NO
    --
    -- Parallel framework: pthreads
    --
    -- Trace: YES (built-in)
    --
    -- Other third-party libraries:
    -- Lapack: NO
    -- Eigen: YES (ver 3.3.2)
    -- Custom HAL: YES (carotene (ver 0.0.1))
    --
    -- NVIDIA CUDA: NO
    --
    -- OpenCL: YES (no extra features)
    -- Include path: /home/pi/opencv/opencv-3.4.0/3rdparty/include/opencl/1.2
    -- Link libraries: Dynamic load
    --
    -- Python 2:
    -- Interpreter: /usr/bin/python2.7 (ver 2.7.13)
    -- Libraries: /usr/lib/arm-linux-gnueabihf/libpython2.7.so (ver 2.7.13)
    -- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.12.1)
    -- packages path: /usr/lib/python2.7/dist-packages
    --
    -- Python 3:
    -- Interpreter: /usr/bin/python3 (ver 3.5.3)
    -- Libraries: /usr/lib/arm-linux-gnueabihf/libpython3.5m.so (ver 3.5.3)
    -- numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.12.1)
    -- packages path: /usr/lib/python3.5/dist-packages
    --
    -- Python (for build): /usr/bin/python2.7
    --
    -- Java:
    -- ant: NO
    -- JNI: NO
    -- Java wrappers: NO
    -- Java tests: NO
    --
    -- Matlab: NO
    --
    -- Install to: /usr/local
    -- -----------------------------------------------------------------
    --
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/pi/opencv/opencv-3.4.0/build

  5. 학생 2018.04.06 18:44 신고

    안녕하세요. 잘보고있습니다. 따라하고 있는 도중...4시간을 기다려 make time을 완료하고 sudo make install 한 뒤 /usr/local/share/OpenCV/samples/
    을 확인을 해보았으나 python 폴더 한개뿐이더군요ㅠ ㅠ 뭐잘못한건가요...

    • webnautes webnautes 2018.04.06 19:45 신고

      C++ 코드가 복사되지 않는 경우도 있습니다.. 그럴 경우 다운로드 받은 소스 코드에 있는 것을 사용하세요~

      opencv/samples/ 위치에 있습니다.

  6. He 2018.04.08 18:30 신고

    저 얼굴인식하는부분에서코드를
    camera.resolution = (128, 128)
    camera.framerate = 32
    rawCapture = PiRGBArray(camera,size=(128, 128))

    time.sleep(0.1)

    motorStop()

    for frame in camera.capture_continuous(rawCapture, format="bgr",
    use_video_port=True):
    image = frame.array
    gray= cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
    face_cascade = cv2.CascadeClassifier('/usr/share/OpenCV/haarcascades/haarcascade_front$

    rawCapture.truncate(0)

    faces = face_cascade.detectMultiScale(gray,1.1,5)
    if(len(faces) == 0):
    motorStop()
    else:
    for (x,y,w,h) in faces:
    cv2.rectangle(image,(x,y),(x+w,y+h),(255,255,0),2)
    print(x,y,w,h)
    idx = 0
    if( w < distance[0]):
    for dist in distance:
    if(w < dist):
    idx = distance.index(dist)
    else:
    break
    else:
    backward()

    deg_turn = x + (w / 2)
    deg_turn = deg_turn - 60.0
    deg_turn = deg_turn * 0.08
    turn(deg_turn)
    print(deg_turn)
    print(idx)
    forward(idx)
    key = cv2.waitKey(1) & 0xFF

    영상처리하면서 DC모터 제어하려는 코드 일부인데

    여기서
    File "op31.py", line 86, in <module>
    faces = face_cascade.detectMultiScale(gray,1.1,5)
    cv2.error: /home/pi/opencv/opencv-3.4.0/modules/objdetect/src/cascadedetect.cpp:1698: error: (-215) !empty() in function detectMultiScale
    이런 오류가나는데 왜 그런지아시나요???

    • webnautes webnautes 2018.04.10 08:05 신고

      찾아보니 xml 파일 위치가 틀리면 발생할 수 있다는데.. 혹시 그전에 동작하는 코드를 기반으로 수정한건가요?

  7. He 2018.04.10 23:22 신고

    네네 그 인터넷에 올라와있던 코드를 그냥 복사붙여넣기해서 해보느냐고...

    • webnautes webnautes 2018.04.11 03:14 신고

      카메라에서 캡처한 영상 크기가 128x128사이즈 인거 같은데..
      너무 작아서 발생하는게 아닌가 싶네요

      화면에 캡처된 이미지를 출력해보세요

  8. Yong 2018.05.03 04:00 신고

    [ 96%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
    c++: internal compiler error: Killed (program cc1plus)
    Please submit a full bug report,
    See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
    modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/_/src2/cv2.cpp.o' failed
    make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/_/src2/cv2.cpp.o] Error 4
    CMakeFiles/Makefile2:7863: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
    make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
    Makefile:160: recipe for target 'all' failed
    make: *** [all] Error 2

    96%에서 이렇게 나와서 막혔는데 뭐가 문제일까요? ㅠㅠ

  9. asddds 2018.05.12 03:10 신고

    안녕하세요 저는 PKG_CONFIG 명령어가 opencv.pc를 읽지 못하고 있는데 저장 위치가 잘못된건가요?

  10. 규규 2018.05.21 19:19 신고

    죄송한데 제가 cmake를 사용하여 OpenCV 컴파일 설정을 해줍니다. 복사해서 터미널에 붙여넣기 해주면 됩니다. 이거 뭔말인지 잘몰라서 일단 cmake 파일을 복사해서 터미널에 붙여넣기를 했는데 아무것도 안나오는데 어떻게해야하나요?

    • webnautes webnautes 2018.05.22 18:12 신고

      라즈베리파이로 연결시 어떤 프로그램을 사용하나요?

      아래 내용을 복사하여
      접속한 프로그램 창 위에서 마우스 오른쪽 버튼을 누르면 터미널에 복사한 내용이 보입니다.

  11. 인형가방 2018.06.03 19:11 신고

    항상 많이 배우고 갑니다. 감사합니다.

  12. 무덤을파는자 2018.07.05 15:04 신고

    잘보고 설치 잘하였습니다. 좋은 자료입니다.

  13. GAN 2018.07.09 21:01 신고

    안녕하세요! 정말 많은 도움 받고있어요!!!

    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_PERF_TESTS=OFF \
    -D ENABLE_NEON=ON \
    > -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 ENABLE_NEON=ON \
    >
    CMake Error: The source directory "/home/pi/opencv/opencv-3.4.1/build/ENABLE_NEON=ON" does not exist.
    Specify --help for usage, or press the help button on the CMake GUI.
    pi@raspberrypi:~/opencv/opencv-3.4.1/build $ -D ENABLE_VFPV3=ON \
    > -D WITH_QT=OFF \
    >
    -bash: -D: command not found
    pi@raspberrypi:~/opencv/opencv-3.4.1/build $ -D WITH_GTK=ON \
    > -D WITH_OPENGL=ON \
    > -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.1/modules \
    > -D WITH_V4L=ON \
    > -D WITH_FFMPEG=ON \
    > -D WITH_XINE=ON \
    > -D BUILD_NEW_PYTHON_SUPPORT=ON \
    > ../
    -bash: -D: command not found


    저 위에 cmake error 왜난걸까요..! 라즈베리를 처음 다뤄봐서 너무어렵네요!! 도와주실 수 있으신가요?

    • webnautes webnautes 2018.07.09 21:32 신고

      cmake 명령어와 옵션들 전체를 복사해서 붙여넣기해보셨나요?

    • GAN 2018.07.09 21:50 신고

      네!! 위에 코드 올려놓으신거 전체 복사해서 붙여넣기 하라고 하셔서 그대로 했어요!

    • webnautes webnautes 2018.07.09 23:19 신고

      보기 좋게 하려고 했던 하이라이트 문제였습니다..
      지금 다시 해보시면 잘 될겁니다.

      덕분에 몰랐던 문제를 찾았네요.. 감사합니다.

  14. 1234 2018.07.25 21:05 신고

    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp: In member function ‘bool cv::{anonymous}::FarnebackOpticalFlowImpl::gaussianBlurOcl(const cv::UMat&, int, cv::UMat&)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp:878:53: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("gaussianBlur", cv::ocl::video::optical_flow_farneback_oclsrc, ""))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp: In member function ‘bool cv::{anonymous}::FarnebackOpticalFlowImpl::gaussianBlur5Ocl(const cv::UMat&, int, cv::UMat&)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp:905:54: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("gaussianBlur5", cv::ocl::video::optical_flow_farneback_oclsrc, ""))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp: In member function ‘bool cv::{anonymous}::FarnebackOpticalFlowImpl::polynomialExpansionOcl(const cv::UMat&, cv::UMat&)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp:938:60: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("polynomialExpansion", cv::ocl::video::optical_flow_farneback_oclsrc, build_options))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp: In member function ‘bool cv::{anonymous}::FarnebackOpticalFlowImpl::boxFilter5Ocl(const cv::UMat&, int, cv::UMat&)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp:967:51: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("boxFilter5", cv::ocl::video::optical_flow_farneback_oclsrc, ""))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp: In member function ‘bool cv::{anonymous}::FarnebackOpticalFlowImpl::updateFlowOcl(const cv::UMat&, cv::UMat&, cv::UMat&)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp:994:51: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("updateFlow", cv::ocl::video::optical_flow_farneback_oclsrc, ""))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp: In member function ‘bool cv::{anonymous}::FarnebackOpticalFlowImpl::updateMatricesOcl(const cv::UMat&, const cv::UMat&, const cv::UMat&, const cv::UMat&, cv::UMat&)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp:1018:55: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("updateMatrices", cv::ocl::video::optical_flow_farneback_oclsrc, ""))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp: In member function ‘virtual void cv::{anonymous}::FarnebackOpticalFlowImpl::calc(cv::InputArray, cv::InputArray, cv::InputOutputArray)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp:1103:46: error: ‘CV_OCL_RUN’ was not declared in this scope
    calc_ocl(_prev0,_next0,_flow0))
    ^
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp:1106:28: error: ‘prev0’ was not declared in this scope
    const Mat* img[2] = { &prev0, &next0 };
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/optflowgf.cpp:1106:36: error: ‘next0’ was not declared in this scope
    const Mat* img[2] = { &prev0, &next0 };
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp: In member function ‘bool cv::{anonymous}::SparsePyrLKOpticalFlowImpl::initWaveSize()’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:937:53: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("lkSparse", cv::ocl::video::pyrlk_oclsrc, ""))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp: In member function ‘bool cv::{anonymous}::SparsePyrLKOpticalFlowImpl::lkSparse_run(cv::UMat&, cv::UMat&, const cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, int, int)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:984:53: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("lkSparse", cv::ocl::video::pyrlk_oclsrc, build_options))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp: In member function ‘virtual void cv::{anonymous}::SparsePyrLKOpticalFlowImpl::calc(cv::InputArray, cv::InputArray, cv::InputArray, cv::InputOutputArray, cv::OutputArray, cv::OutputArray)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:1229:16: error: ‘isOpenCLActivated’ is not a member of ‘cv::ocl’
    CV_OCL_RUN(ocl::isOpenCLActivated() &&
    ^~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:1232:95: error: ‘CV_OCL_RUN’ was not declared in this scope
    ocl_calcOpticalFlowPyrLK(_prevImg, _nextImg, _prevPts, _nextPts, _status, _err))
    ^
    In file included from /home/pi/opencv/opencv-3.4.1/modules/core/include/opencv2/core.hpp:54:0,
    from /home/pi/opencv/opencv-3.4.1/modules/video/include/opencv2/video/tracking.hpp:47,
    from /home/pi/opencv/opencv-3.4.1/modules/video/include/opencv2/video.hpp:56,
    from /home/pi/opencv/opencv-3.4.1/build/modules/video/precomp.hpp:46:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:1244:27: error: ‘prevPtsMat’ was not declared in this scope
    CV_Assert( (npoints = prevPtsMat.checkVector(2, CV_32F, true)) >= 0 );
    ^
    /home/pi/opencv/opencv-3.4.1/modules/core/include/opencv2/core/base.hpp:455:35: note: in definition of macro ‘CV_Assert_1’
    #define CV_Assert_1( expr ) if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
    ^~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:1244:5: note: in expansion of macro ‘CV_Assert’
    CV_Assert( (npoints = prevPtsMat.checkVector(2, CV_32F, true)) >= 0 );
    ^~~~~~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:1255:25: error: ‘prevPtsMat’ was not declared in this scope
    _nextPts.create(prevPtsMat.size(), prevPtsMat.type(), -1, true);
    ^~~~~~~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:1260:30: error: ‘prevPtsMat’ was not declared in this scope
    const Point2f* prevPts = prevPtsMat.ptr<Point2f>();
    ^~~~~~~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:1260:52: error: expected primary-expression before ‘>’ token
    const Point2f* prevPts = prevPtsMat.ptr<Point2f>();
    ^
    /home/pi/opencv/opencv-3.4.1/modules/video/src/lkpyramid.cpp:1260:54: error: expected primary-expression before ‘)’ token
    const Point2f* prevPts = prevPtsMat.ptr<Point2f>();
    ^
    /home/pi/opencv/opencv-3.4.1/modules/video/src/tvl1flow.cpp: In function ‘bool {anonymous}::cv_ocl_tvl1flow::centeredGradient(const cv::UMat&, cv::UMat&, cv::UMat&)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/tvl1flow.cpp:239:59: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("centeredGradientKernel", cv::ocl::video::optical_flow_tvl1_oclsrc, ""))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/tvl1flow.cpp: In function ‘bool {anonymous}::cv_ocl_tvl1flow::warpBackward(const cv::UMat&, const cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/tvl1flow.cpp:260:55: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("warpBackwardKernel", cv::ocl::video::optical_flow_tvl1_oclsrc, ""))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/tvl1flow.cpp: In function ‘bool {anonymous}::cv_ocl_tvl1flow::estimateU(cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, float, float, char)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/tvl1flow.cpp:304:52: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("estimateUKernel", cv::ocl::video::optical_flow_tvl1_oclsrc, ""))
    ^~~~~
    /home/pi/opencv/opencv-3.4.1/modules/video/src/tvl1flow.cpp: In function ‘bool {anonymous}::cv_ocl_tvl1flow::estimateDualVariables(cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, cv::UMat&, float)’:
    /home/pi/opencv/opencv-3.4.1/modules/video/src/tvl1flow.cpp:345:64: error: ‘cv::ocl::video’ has not been declared
    if (!kernel.create("estimateDualVariablesKernel", cv::ocl::video::optical_flow_tvl1_oclsrc, ""))
    ^~~~~
    modules/video/CMakeFiles/opencv_video.dir/build.make:239: 'modules/video/CMakeFiles/opencv_video.dir/src/optflowgf.cpp.o' 타겟에 대한 명령이 실패했습니다
    make[2]: *** [modules/video/CMakeFiles/opencv_video.dir/src/optflowgf.cpp.o] 오류 1
    make[2]: *** 끝나지 않은 작업을 기다리고 있습니다....
    modules/video/CMakeFiles/opencv_video.dir/build.make:215: 'modules/video/CMakeFiles/opencv_video.dir/src/lkpyramid.cpp.o' 타겟에 대한 명령이 실패했습니다
    make[2]: *** [modules/video/CMakeFiles/opencv_video.dir/src/lkpyramid.cpp.o] 오류 1
    modules/video/CMakeFiles/opencv_video.dir/build.make:263: 'modules/video/CMakeFiles/opencv_video.dir/src/tvl1flow.cpp.o' 타겟에 대한 명령이 실패했습니다
    make[2]: *** [modules/video/CMakeFiles/opencv_video.dir/src/tvl1flow.cpp.o] 오류 1
    CMakeFiles/Makefile2:3651: 'modules/video/CMakeFiles/opencv_video.dir/all' 타겟에 대한 명령이 실패했습니다
    make[1]: *** [modules/video/CMakeFiles/opencv_video.dir/all] 오류 2
    Makefile:160: 'all' 타겟에 대한 명령이 실패했습니다
    make: *** [all] 오류 2

    ---------------------------------------------------
    는 오류가뜨는데요 중간에 54프로까지 고 잠깐꺼졋다 켜졋는데 저렇게 됫습니다. 이경우 재설치 해야요???

    • webnautes webnautes 2018.07.25 21:13 신고

      ocl.hpp를 잘못 include를 해서 생긴 문제로 보입니다.
      다음 링크를 참고하세요.

      https://stackoverflow.com/questions/34422276/opencv-3-0-error-include-ocl-hpp

    • 1234 2018.07.25 21:27 신고

      어떻게 이걸 수정할수가 잇을까요???

    • webnautes webnautes 2018.07.25 21:30 신고

      ocl.hpp를 인크루드 해서 생긴문제라면 다음처럼 해보세요.

      #include <opencv2/core/ocl.hpp>

  15. hi 2018.07.30 20:53 신고

    pi@raspberrypi:~/opencv/opencv-3.4.1/build $ cmake -D CMAKE_BUILD_TYPE=RELEASE\
    > D WITH_TBB=OFF\
    >
    CMake Error: The source directory "/home/pi/opencv/opencv-3.4.1/build/WITH_TBB=OFF" does not exist.
    Specify --help for usage, or press the help button on the CMake GUI.

  16. chan017 2018.07.31 09:28 신고

    cmake를 실행하면
    아래처럼 홈페이지 화면과 틀리게 나옴니다.
    -- GUI:
    -- GTK+: YES (ver 2.24.31)
    -- GThread : YES (ver 2.50.3)
    -- GtkGlExt: YES (ver 1.2.0)------------------------->NO 나옴
    -- OpenGL support: YES (/usr/lib/arm-linux-gnueabihf/libGLU.so /usr/lib/arm-linux-gnueabihf/libGL.so) ------>NO나옴
    -- VTK support: NO
    --
    -- Media I/O:
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    pi@raspberrypi:~/opencv/opencv-3.4.1/build $ make -j4실행하면
    98%]Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.p
    98%]Building CXX object modules/python3/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.p
    멈춰서 더이상 진행이 안되요
    그리고 아래 진행할 때 선택가능한 패키지에서 에러가 발생했습니다.
    3-8. OpenCV에서는 highgui 모듈을 사용하여 자체적으로 윈도우 생성하여 이미지나 비디오들을 보여줄 수 있습니다.
    윈도우 생성 등의 GUI를 위해 gtk 또는 qt를 선택해서 사용가능합니다. 여기서는 gtk2를 지정해주었습니다.
    $ sudo apt-get install libgtk2.0-dev
    그외 선택 가능한 패키지는 다음과 같습니다.

    libgtk-3-dev --->$ sudo apt-get install libgtk3-dev 설치됨
    libqt4-dev --->$ sudo apt-get install libqt4-dev 에러발생
    libqt5-dev --->$ sudo apt-get install libqt5-dev 에러발생

    • webnautes webnautes 2018.07.31 09:53 신고

      libqt4-dev 또는 libqt5-dev 외에도 추가로 설치해야하는 패키지들이 있어서 에러가 난듯합니다.

      포스팅은 gtk 2.0을 기준으로 되어 있습니다.


      OpenGL 관련 해서 NO 나온것은 다음 패키지와 관련있는 듯한데.. 모두 설치한 상태인가요?

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

      $ sudo apt-get install mesa-utils libgl1-mesa-dri libgtkgl2.0-dev libgtkglext1-dev

  17. SG 2018.07.31 21:44 신고

    안녕하세요
    혹시 2018-6-25에 최종 업데이트 되기 전 글에서는 OpenCV 3.4.0 버전이었나요?
    그전에도 여기에서 따라해서 OpenCV 잘만 실행시켰었는데, 새로운 최신버전으로 따라하니까 안되네요.

    불과 한달전 6월21일에 다시 설치하고 했을때도 잘 됐었는데, 오늘은 되긴하는데 OpenCV 실행시 새로운 오류가 생기네요.
    한달전엔 Raspbian도 6월 27일 버전 말고 아마 4월18일 버전이었을겁니다. 거기에 제 추측이 맞다면 OpenCV 3.4.0으로 설치후 돌렸을땐 아무 문제가 없었어요.
    하지만 지금은 어떤 문제가 발생하냐면, " imshow " 함수를 동작시킬때 문제가 생깁니다.

    프로그램은 아무 이상없이 잘 동작하지만 가끔가다가 imshow 함수가 업데이트가 안돼요. 그래서 Window가 그대로 멈춰있습니다.
    그리고 간혹 글씨 깨짐 현상도 발생합니다. 이건 libbluetooth 라이브러리 때문인지는 모르겠으나 어쨌든 무언가 라이브러리에서 충돌이 나거나, 새로운 버전의 Raspbian이 clock이나 다른 시스템의 값이 전 버전과 달라서 생기는 문제 같습니다만...

    혹시 원인에 대해서 집히시는게 있나요?

    • webnautes webnautes 2018.07.31 23:59 신고

      최근에 설치시 기존 qt4사용하던걸 gtk2로 다시 변경했었습니다.

      시간을 두고 확인해봐야 할듯하네요..

    • SG 2018.08.01 00:08 신고

      그렇다면 최근에 사용하던 qt4로 다시 변경하려면 어떻게 해야하나요?

    • SG 2018.08.01 01:56 신고


      gtk2에서 qt4로 변경했더니 잘 돌아가네요.
      제가 쓰던 라이브러리가 OpenCV를 이용한 라이브러리였는데, gtk와는 호환이 잘 되지 않았나봅니다. qt4로 바꾸고나니 전처럼 원할하게 잘 돌아갑니다. 이것 때문에 어제부터 꼬박 밤새고 제대로 진도도 못나갔었는데 ㅜ 빠른 답변 덕분에 금방 해결할 수 있었습니다.

    • webnautes webnautes 2018.08.01 10:18 신고

      해결하셨다니 다행이네요..라이브러리간 충돌이었나봅니다

  18. 27315co 2018.08.01 12:11 신고

    알려주신방법대로 설치를 하여서 facedetect 예제까지 작동하는데 성공하였습니다. 정말 감사드립니다.
    그런데 제가 여쭤보고싶은 몇가지 사항이 더있는데요 opencv 의 samples 폴더에보니까 예제들이 정말많던데
    제가 리눅스가 처음이여서 이 예제 들을 컴파일하고 빌드를해서 실행을하고싶은데 리눅스 문법을 잘몰라서 예제들을 어떻게하면
    컴파일하고 실행시킬수있는지 알려주신다면 정말 감사하겠습니다.

    • webnautes webnautes 2018.08.01 12:18 신고

      다음처럼 컴파일하시면 됩니다.

      facedetect.cpp 파일을 컴파일하여 실행파일 facedetect를 생성하는 겁니다.

      g++ -o facedetect facedetect.cpp $(pkg-config --libs --cflags opencv)  


      예제마다 실행하는 방법이 다를 수 있기때문에 OpenCV 공식 홈페이지의 Tutorial을 참고하거나 코드에 있는 주석을 참고해야 합니다..

      때로는 코드를 분석해야 실행가능한 경우도 있습니다.

  19. 27315co 2018.08.01 14:33 신고

    아 정말 감사드립니다. 그렇다면 말씀하신대로 하면 컴파일을 할수있다는뜻인데 그렇다면
    아랫줄의
    ./facedetect --cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml" --nested-cascade="/usr/local/share/OpenCV/haarcascades/haarcascade_eye_tree_eyeglasses.xml " --scale=1.3

    이것은 왜사용하는것이죠??? 그리고 예제코드를가져올때 $ cp /usr/local/share/OpenCV/samples/cpp/facedetect.cpp ./
    이것은 왜해주는것인가요???

    • webnautes webnautes 2018.08.01 15:12 신고

      얼굴인식 코드를 현재위치로 복사(cp)해서..

      얼굴 인식 코드에서 필요한 xml 파일 2개를 지정해서 실행한것입니다.

    • 27315co 2018.08.01 15:21 신고

      아 그런것이군요 정말감사합니다.!~

  20. yukjeonghun 2018.08.03 19:29 신고

    질문드립니다 ㅜ
    make -j4 입력한뒤 컴파일을 하는데 다음과 같은 에러가 뜹니다..

    [86%] Building CXX object modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/ellipticKeyPoint.cpp.o
    /home/pi/opencv/opencv_contrib-3.4.1/modules/xfeatures2d/src/boostdesc.cpp:653:37: fatal error: boostdesc_bgm.i: No such file or directory
    #include "boostdesc_bgm.i"
    ^
    compilation terminated.
    modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/build.make:91: recipe for target 'modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/boostdesc.cpp.o' failed
    make[2]: *** [modules/xfeatures2d/CMakeFiles/opencv_xfeatures2d.dir/src/boostdesc.cpp.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    [ 86%] Built target opencv_ximgproc

    • webnautes webnautes 2018.08.04 15:51 신고

      cmake시 인터넷 연결된 상태에서 했나요?

      해당 파일들은 cmake명령시 다운로드 됩니다.

      -- 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
      -- xfeatures2d/vgg: Download: vgg_generated_48.i
      -- xfeatures2d/vgg: Download: vgg_generated_64.i
      -- xfeatures2d/vgg: Download: vgg_generated_80.i
      -- xfeatures2d/vgg: Download: vgg_generated_120.i
      -- data: Download: face_landmark_model.dat

  21. Cosak 2018.08.12 20:14 신고

    pkg-config 명령이 /usr/local/lib/pkgconfig 경로에 있는 opencv.pc 파일을 찾을 수 있도록 해줘야 합니다.

    $ sudo sh -c 'echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig >> /etc/bash.bashrc'
    $ sudo sh -c 'echo export PKG_CONFIG_PATH >> /etc/bash.bashrc'

    로그아웃했다가 로그인하면 적용이됩니다.

    이 부분을 진행해도 다시
    pi@raspberrypi:~/opencv/opencv-3.4.1/build $ 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

    이렇게 나옵니다. 다른 해결방법이 있을까요? 리플 부탁드리겠습니다.. ㅠ

+ Recent posts

티스토리 툴바