在OpenCV3上使用GUI功能时出错

时间:2015-06-01 00:35:41

标签: python macos opencv

我刚刚从来源安装了opencv3。我正确地获得了cv2.so库,我可以在Python中正确访问该模块。

import cv2

但是当我使用一些 GUI 函数时,我会收到错误:

cv2.imshow('frame',frame)
cv2.error: /Users/****/****/opencv-3.0.0-rc1/modules/highgui/src/window.cpp:534: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage

这是cmake输出,我可以看到Cocoa:YES,所以我想一切都应该没问题。

有什么建议吗?

General configuration for OpenCV 3.0.0-rc1 =====================================
--   Version control:               unknown
--
--   Platform:
--     Host:                        Darwin 14.3.0 x86_64
--     CMake:                       3.2.2
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /opt/local/bin/gmake
--     Configuration:               Release
--
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /opt/local/bin/c++  (ver 4.8.4)
--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /opt/local/bin/gcc
--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):
--     Linker flags (Debug):
--     Precompiled headers:         YES
--
--   OpenCV modules:
--     To be built:                 hal core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d stitching videostab python2
--     Disabled:                    viz world
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python3
--
--   GUI:
--     QT:                          NO
--     Cocoa:                       YES
--     OpenGL support:              NO
--     VTK support:                 YES (ver 6.2.0)
--
--   Media I/O:
--     ZLib:                        /usr/lib/libz.dylib (ver 1.2.5)
--     JPEG:                        /opt/local/lib/libjpeg.dylib (ver 90)
--     WEBP:                        /opt/local/lib/libwebp.dylib (ver encoder: 0x0202)
--     PNG:                         /opt/local/lib/libpng.dylib (ver 1.6.17)
--     TIFF:                        /opt/local/lib/libtiff.dylib (ver 42 - 4.0.3)
--     JPEG 2000:                   /opt/local/lib/libjasper.dylib (ver 1.900.1)
--     OpenEXR:                     /opt/local/lib/libImath.dylib /opt/local/lib/libIlmImf.dylib /opt/local/lib/libIex.dylib /opt/local/lib/libHalf.dylib /opt/local/lib/libIlmThread.dylib (ver 1.7.0)
--     GDAL:                        NO
--
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  YES (ver 2.2.0)
--     FFMPEG:                      YES
--       codec:                     YES (ver Unknown)
--       format:                    YES (ver Unknown)
--       util:                      YES (ver Unknown)
--       swscale:                   YES (ver Unknown)
--       resample:                  YES (ver Unknown)
--       gentoo-style:              YES
--     GStreamer:
--       base:                      YES (ver 1.4.5)
--       video:                     YES (ver 1.4.5)
--       app:                       YES (ver 1.4.5)
--       riff:                      YES (ver 1.4.5)
--       pbutils:                   YES (ver 1.4.5)
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     QuickTime:                   NO
--     QTKit:                       NO
--     V4L/V4L2:                    NO/NO
--     XIMEA:                       NO
--
--   Other third-party libraries:
--     Use IPP:                     8.2.1 [8.2.1]
--          at:                     /Users/***/***/opencv-3.0.0-rc1/3rdparty/ippicv/unpack/ippicv_osx
--     Use IPP Async:               NO
--     Use Eigen:                   YES (ver 3.2.4)
--     Use TBB:                     YES (ver 4.3 interface 8003)
--     Use OpenMP:                  NO
--     Use GCD                      NO
--     Use Concurrency              NO
--     Use C=:                      NO
--     Use Cuda:                    NO
--     Use OpenCL:                  YES
--
--   OpenCL:
--     Version:                     static
--     libraries:                   -framework OpenCL
--     Use AMDFFT:                  NO
--     Use AMDBLAS:                 NO
--
--   Python 2:
--     Interpreter:                 /opt/local/bin/python2.7 (ver 2.7.9)
--     Libraries:                   /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib (ver 2.7.9)
--     numpy:                       /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include (ver 1.9.2)
--     packages path:               lib/python2.7/site-packages
--
--   Python 3:
--     Interpreter:                 (ver 3.4.3)
--
--   Python (for build):            /opt/local/bin/python2.7
--
--   Java:
--     ant:                         NO
--     JNI:                         /System/Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers
--     Java wrappers:               NO
--     Java tests:                  NO
--
--   Matlab:
--     mex:                         /Applications/MATLAB_R2015a.app/bin/mex
--     Compiler/generator:          Not working (bindings will not be generated)
--
--   Documentation:
--     Doxygen:                     /opt/local/bin/doxygen (ver 1.8.9.1)
--     PlantUML:                    NO
--
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     C/C++ Examples:              NO
--
--   Install path:                  /usr/local
--
--   cvconfig.h is in:              /Users/***/***/opencv-3.0.0-rc1/build
-- -----------------------------------------------------------------
--
-- Configuring done
-- Generating done

1 个答案:

答案 0 :(得分:0)

解决了它。 用-DWITH_QT=ON编译解决它(必须安装qt4-mac((来自Macports))