fatal error: 'QTKit/QTKit.h' file not found when I build OpenCV on mac

匿名 (未验证) 提交于 2019-12-03 01:25:01

问题:

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:

  1. Download MACOSX SDK here.
  2. extract head files from MacOSX10.11.sdk/MacOSX10.11.sdk/System/Library/Frameworks/QTKit.framework/Headers/
  3. Create a folder under opencv source file folder: opencv-3.2.0/modules/highgui/src/QTKit, and copy all header files into the folder.
  4. 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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!