可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I have followed this http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/ to install OpenCV on my mac. When I do this step : $ make -j4 a problem happened:
fatal error: 'QTKit/QTKit.h' file not found #import ^ 1 error generated. make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_qtkit.mm.o] Error 1 make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2 make: *** [all] Error 2
回答1:
Try building it like this instead:
cmake -DWITH_QUICKTIME=OFF -DWITH_GSTREAMER=OFF -DWITH_FFMPEG=OFF -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_BUILD_TYPE=Release .. ; make -j4
回答2:
Can you try to install opencv on mac using brew?
brew reinstall opencv3 --HEAD --with-python3 --with-ffmpeg --with-tbb --with-contrib
Worked for me on MAC OS SIERRA.
回答3:
Here is a workaround solution to fix the issue:
- Download MACOSX SDK here.
- extract head files from
MacOSX10.11.sdk/MacOSX10.11.sdk/System/Library/Frameworks/QTKit.framework/Headers/
- Create a folder under opencv source file folder:
opencv-3.2.0/modules/highgui/src/QTKit
, and copy all header files into the folder. - Follow the regular opencv build steps. When you run make -j8, you don't need set
"-DWITH_QUICKTIME=OFF -DWITH_GSTREAMER=OFF -DWITH_FFMPEG=OFF"
This works for opencv2.x and 3.x
回答4:
This error is because of QuickTime Kit was deprecated in OS X v10.9,and Apple suggest to use AVFoundation framework instead Apple API Reference.
OpenCV (version 3.1.0) is relaying on QuickTime Kit. So, when you trying to install OpenCV (before version 3.1.0) on OSX Sierra, It will raise error when you make.
Try install the master version of opencv will be OK !
OpenCV had AVFoundation Framework supported in https://github.com/opencv/opencv/pull/7159
回答5:
use --with-quicktime
or -DWITH_QUICKTIME=TRUE
. It will use QUITCKTIME Instead of QTKit for Video I/O