MacOS Sierra 配置 OpenCV 2.4.13

MacOS Sierra 配置 OpenCV 2.4.13

系统环境:MacOS Sierra 10.12.5 系统
安装软件: Opencv2.4.13

1. 下载Opencv 2.4.13程序源码包Opencv 2.4.13 Download
2. 解压2.4.13.zip压缩包,并在../modules/highgui/src文件夹内加入QTKit文件夹。

备注:加入QTKit文件夹是为了解决Opencv编译过程中出现的「‘QTKit/QTKit.h‘ file not found」报错

3. 打开终端进入opencv-2.4.13文件夹中(命令行:cd /Desktop/opencv-2.4.13)

mkdir release 
cd release
cmake -G "Unix Makefiles" ..
make -j4

执行MAKE指令后,进入环境编译直到出现以下结果表明编译成功

[100%] Linking CXX shared library ../../lib/libopencv_contrib.dylib
[100%] Built target opencv_contrib
Scanning dependencies of target opencv_test_contrib
[100%] Building CXX object modules/contrib/CMakeFiles/opencv_test_contrib.dir/test/test_main.cpp.o
[100%] Linking CXX executable ../../bin/opencv_test_contrib
[100%] Built target opencv_test_contrib

4. 接着在终端运行指令:sudo make install。

建议使用sudo命令。如果采用非sudo命令即make install的话会出现以下报错:

Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/include/opencv2/opencv_modules.hpp
CMake Error at cmake_install.cmake:31 (file):
  file INSTALL cannot copy file
  "/Users/meixinhu/Desktop/opencv-2.4.13/release/opencv2/opencv_modules.hpp"
  to "/usr/local/include/opencv2/opencv_modules.hpp".

make: *** [install] Error 1

运行过程输出如下:

[  2%] Built target zlib
[  6%] Built target libtiff
[ 11%] Built target libjpeg
[ 15%] Built target libjasper
[ 16%] Built target libpng
[ 23%] Built target IlmImf
[ 26%] Built target opencv_core
[ 30%] Built target opencv_imgproc
[ 32%] Built target opencv_highgui
[ 32%] Built target opencv_flann
[ 34%] Built target opencv_features2d
[ 36%] Built target opencv_calib3d
[ 37%] Built target opencv_video
[ 38%] Built target opencv_ts
[ 40%] Built target opencv_perf_core
[ 41%] Built target opencv_test_core
[ 41%] Built target opencv_test_flann
[ 43%] Built target opencv_test_imgproc
[ 45%] Built target opencv_perf_imgproc
[ 46%] Built target opencv_test_highgui
[ 46%] Built target opencv_perf_highgui
[ 47%] Built target opencv_perf_features2d
[ 49%] Built target opencv_test_features2d
[ 49%] Built target opencv_perf_calib3d
[ 51%] Built target opencv_test_calib3d
[ 53%] Built target opencv_ml
[ 54%] Built target opencv_test_ml
[ 54%] Built target opencv_perf_video
[ 55%] Built target opencv_test_video
[ 63%] Built target opencv_legacy
[ 64%] Built target opencv_test_legacy
[ 65%] Built target opencv_objdetect
[ 65%] Built target opencv_test_objdetect
[ 65%] Built target opencv_perf_objdetect
[ 66%] Built target opencv_photo
[ 66%] Built target opencv_perf_photo
[ 66%] Built target opencv_test_photo
[ 72%] Built target opencv_gpu
[ 73%] Built target opencv_perf_gpu
[ 76%] Built target opencv_test_gpu
[ 81%] Built target opencv_ocl
[ 84%] Built target opencv_perf_ocl
[ 87%] Built target opencv_test_ocl
[ 88%] Built target opencv_nonfree
[ 89%] Built target opencv_test_nonfree
[ 90%] Built target opencv_perf_nonfree
[ 93%] Built target opencv_contrib
[ 93%] Built target opencv_test_contrib
[ 94%] Built target opencv_stitching
[ 94%] Built target opencv_test_stitching
[ 94%] Built target opencv_perf_stitching
[ 95%] Built target opencv_superres
[ 96%] Built target opencv_perf_superres
[ 97%] Built target opencv_test_superres
[ 98%] Built target opencv_videostab
[ 99%] Built target opencv_haartraining_engine
[ 99%] Built target opencv_haartraining
[ 99%] Built target opencv_createsamples
[ 99%] Built target opencv_performance
[100%] Built target opencv_traincascade
[100%] Built target opencv_annotation
[100%] Built target opencv_visualisation
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/include/opencv2/opencv_modules.hpp
-- Installing: /usr/local/lib/pkgconfig/opencv.pc
-- Installing: /usr/local/share/OpenCV/OpenCVConfig.cmake
-- Installing: /usr/local/share/OpenCV/OpenCVConfig-version.cmake
-- Old export file "/usr/local/share/OpenCV/OpenCVModules.cmake" will be replaced.  Removing files [/usr/local/share/OpenCV/OpenCVModules-release.cmake].
-- Installing: /usr/local/share/OpenCV/OpenCVModules.cmake
-- Installing: /usr/local/share/OpenCV/OpenCVModules-release.cmake
-- Installing: /usr/local/include/opencv/cv.h
-- Installing: /usr/local/include/opencv/cv.hpp
-- Installing: /usr/local/include/opencv/cvaux.h
-- Installing: /usr/local/include/opencv/cvaux.hpp
-- Installing: /usr/local/include/opencv/cvwimage.h
-- Installing: /usr/local/include/opencv/cxcore.h
-- Installing: /usr/local/include/opencv/cxcore.hpp
-- Installing: /usr/local/include/opencv/cxeigen.hpp
-- Installing: /usr/local/include/opencv/cxmisc.h
-- Installing: /usr/local/include/opencv/highgui.h
-- Installing: /usr/local/include/opencv/ml.h
-- Installing: /usr/local/include/opencv2/opencv.hpp
-- Installing: /usr/local/lib/libopencv_core.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_core.2.4.dylib
-- Installing: /usr/local/lib/libopencv_core.dylib
-- Installing: /usr/local/include/opencv2/core.hpp
-- Installing: /usr/local/include/opencv2/core/affine.hpp
-- Installing: /usr/local/include/opencv2/core/core.hpp
-- Installing: /usr/local/include/opencv2/core/cuda_devptrs.hpp
-- Installing: /usr/local/include/opencv2/core/devmem2d.hpp
-- Installing: /usr/local/include/opencv2/core/eigen.hpp
-- Installing: /usr/local/include/opencv2/core/gpumat.hpp
-- Installing: /usr/local/include/opencv2/core/internal.hpp
-- Installing: /usr/local/include/opencv2/core/mat.hpp
-- Installing: /usr/local/include/opencv2/core/opengl_interop.hpp
-- Installing: /usr/local/include/opencv2/core/opengl_interop_deprecated.hpp
-- Installing: /usr/local/include/opencv2/core/operations.hpp
-- Installing: /usr/local/include/opencv2/core/version.hpp
-- Installing: /usr/local/include/opencv2/core/wimage.hpp
-- Installing: /usr/local/include/opencv2/core/core_c.h
-- Installing: /usr/local/include/opencv2/core/types_c.h
-- Installing: /usr/local/lib/libopencv_flann.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_flann.2.4.dylib
-- Installing: /usr/local/lib/libopencv_flann.dylib
-- Installing: /usr/local/include/opencv2/flann.hpp
-- Installing: /usr/local/include/opencv2/flann/flann.hpp
-- Installing: /usr/local/include/opencv2/flann/flann_base.hpp
-- Installing: /usr/local/include/opencv2/flann/miniflann.hpp
-- Installing: /usr/local/include/opencv2/flann/all_indices.h
-- Installing: /usr/local/include/opencv2/flann/allocator.h
-- Installing: /usr/local/include/opencv2/flann/any.h
-- Installing: /usr/local/include/opencv2/flann/autotuned_index.h
-- Installing: /usr/local/include/opencv2/flann/composite_index.h
-- Installing: /usr/local/include/opencv2/flann/config.h
-- Installing: /usr/local/include/opencv2/flann/defines.h
-- Installing: /usr/local/include/opencv2/flann/dist.h
-- Installing: /usr/local/include/opencv2/flann/dummy.h
-- Installing: /usr/local/include/opencv2/flann/dynamic_bitset.h
-- Installing: /usr/local/include/opencv2/flann/general.h
-- Installing: /usr/local/include/opencv2/flann/ground_truth.h
-- Installing: /usr/local/include/opencv2/flann/hdf5.h
-- Installing: /usr/local/include/opencv2/flann/heap.h
-- Installing: /usr/local/include/opencv2/flann/hierarchical_clustering_index.h
-- Installing: /usr/local/include/opencv2/flann/index_testing.h
-- Installing: /usr/local/include/opencv2/flann/kdtree_index.h
-- Installing: /usr/local/include/opencv2/flann/kdtree_single_index.h
-- Installing: /usr/local/include/opencv2/flann/kmeans_index.h
-- Installing: /usr/local/include/opencv2/flann/linear_index.h
-- Installing: /usr/local/include/opencv2/flann/logger.h
-- Installing: /usr/local/include/opencv2/flann/lsh_index.h
-- Installing: /usr/local/include/opencv2/flann/lsh_table.h
-- Installing: /usr/local/include/opencv2/flann/matrix.h
-- Installing: /usr/local/include/opencv2/flann/nn_index.h
-- Installing: /usr/local/include/opencv2/flann/object_factory.h
-- Installing: /usr/local/include/opencv2/flann/params.h
-- Installing: /usr/local/include/opencv2/flann/random.h
-- Installing: /usr/local/include/opencv2/flann/result_set.h
-- Installing: /usr/local/include/opencv2/flann/sampling.h
-- Installing: /usr/local/include/opencv2/flann/saving.h
-- Installing: /usr/local/include/opencv2/flann/simplex_downhill.h
-- Installing: /usr/local/include/opencv2/flann/timer.h
-- Installing: /usr/local/lib/libopencv_imgproc.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_imgproc.2.4.dylib
-- Installing: /usr/local/lib/libopencv_imgproc.dylib
-- Installing: /usr/local/include/opencv2/imgproc.hpp
-- Installing: /usr/local/include/opencv2/imgproc/imgproc.hpp
-- Installing: /usr/local/include/opencv2/imgproc/imgproc_c.h
-- Installing: /usr/local/include/opencv2/imgproc/types_c.h
-- Installing: /usr/local/lib/libopencv_highgui.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_highgui.2.4.dylib
-- Installing: /usr/local/lib/libopencv_highgui.dylib
-- Installing: /usr/local/include/opencv2/highgui.hpp
-- Installing: /usr/local/include/opencv2/highgui/highgui.hpp
-- Installing: /usr/local/include/opencv2/highgui/cap_ios.h
-- Installing: /usr/local/include/opencv2/highgui/highgui_c.h
-- Installing: /usr/local/include/opencv2/highgui/ios.h
-- Installing: /usr/local/lib/libopencv_features2d.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_features2d.2.4.dylib
-- Installing: /usr/local/lib/libopencv_features2d.dylib
-- Installing: /usr/local/include/opencv2/features2d.hpp
-- Installing: /usr/local/include/opencv2/features2d/features2d.hpp
-- Installing: /usr/local/lib/libopencv_calib3d.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_calib3d.2.4.dylib
-- Installing: /usr/local/lib/libopencv_calib3d.dylib
-- Installing: /usr/local/include/opencv2/calib3d.hpp
-- Installing: /usr/local/include/opencv2/calib3d/calib3d.hpp
-- Installing: /usr/local/lib/libopencv_ml.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_ml.2.4.dylib
-- Installing: /usr/local/lib/libopencv_ml.dylib
-- Installing: /usr/local/include/opencv2/ml.hpp
-- Installing: /usr/local/include/opencv2/ml/ml.hpp
-- Installing: /usr/local/lib/libopencv_video.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_video.2.4.dylib
-- Installing: /usr/local/lib/libopencv_video.dylib
-- Installing: /usr/local/include/opencv2/video.hpp
-- Installing: /usr/local/include/opencv2/video/background_segm.hpp
-- Installing: /usr/local/include/opencv2/video/tracking.hpp
-- Installing: /usr/local/include/opencv2/video/video.hpp
-- Installing: /usr/local/lib/libopencv_legacy.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_legacy.2.4.dylib
-- Installing: /usr/local/lib/libopencv_legacy.dylib
-- Installing: /usr/local/include/opencv2/legacy/blobtrack.hpp
-- Installing: /usr/local/include/opencv2/legacy/compat.hpp
-- Installing: /usr/local/include/opencv2/legacy/legacy.hpp
-- Installing: /usr/local/include/opencv2/legacy/streams.hpp
-- Installing: /usr/local/lib/libopencv_objdetect.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_objdetect.2.4.dylib
-- Installing: /usr/local/lib/libopencv_objdetect.dylib
-- Installing: /usr/local/include/opencv2/objdetect.hpp
-- Installing: /usr/local/include/opencv2/objdetect/objdetect.hpp
-- Installing: /usr/local/lib/libopencv_photo.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_photo.2.4.dylib
-- Installing: /usr/local/lib/libopencv_photo.dylib
-- Installing: /usr/local/include/opencv2/photo.hpp
-- Installing: /usr/local/include/opencv2/photo/photo.hpp
-- Installing: /usr/local/include/opencv2/photo/photo_c.h
-- Installing: /usr/local/lib/libopencv_gpu.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_gpu.2.4.dylib
-- Installing: /usr/local/lib/libopencv_gpu.dylib
-- Installing: /usr/local/include/opencv2/gpu/devmem2d.hpp
-- Installing: /usr/local/include/opencv2/gpu/gpu.hpp
-- Installing: /usr/local/include/opencv2/gpu/gpumat.hpp
-- Installing: /usr/local/include/opencv2/gpu/stream_accessor.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/block.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/border_interpolate.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/color.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/common.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/datamov_utils.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/dynamic_smem.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/emulation.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/filters.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/funcattrib.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/functional.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/limits.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/reduce.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/saturate_cast.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/scan.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/simd_functions.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/static_check.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/transform.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/type_traits.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/utility.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/vec_distance.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/vec_math.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/vec_traits.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/warp.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/warp_reduce.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/warp_shuffle.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/detail/color_detail.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/detail/reduce.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/detail/reduce_key_val.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/detail/transform_detail.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/detail/type_traits_detail.hpp
-- Installing: /usr/local/include/opencv2/gpu/device/detail/vec_distance_detail.hpp
-- Installing: /usr/local/lib/libopencv_ocl.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_ocl.2.4.dylib
-- Installing: /usr/local/lib/libopencv_ocl.dylib
-- Installing: /usr/local/include/opencv2/ocl/matrix_operations.hpp
-- Installing: /usr/local/include/opencv2/ocl/ocl.hpp
-- Installing: /usr/local/lib/libopencv_nonfree.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_nonfree.2.4.dylib
-- Installing: /usr/local/lib/libopencv_nonfree.dylib
-- Installing: /usr/local/include/opencv2/nonfree/features2d.hpp
-- Installing: /usr/local/include/opencv2/nonfree/gpu.hpp
-- Installing: /usr/local/include/opencv2/nonfree/nonfree.hpp
-- Installing: /usr/local/include/opencv2/nonfree/ocl.hpp
-- Installing: /usr/local/lib/libopencv_contrib.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_contrib.2.4.dylib
-- Installing: /usr/local/lib/libopencv_contrib.dylib
-- Installing: /usr/local/include/opencv2/contrib/contrib.hpp
-- Installing: /usr/local/include/opencv2/contrib/detection_based_tracker.hpp
-- Installing: /usr/local/include/opencv2/contrib/hybridtracker.hpp
-- Installing: /usr/local/include/opencv2/contrib/openfabmap.hpp
-- Installing: /usr/local/include/opencv2/contrib/retina.hpp
-- Installing: /usr/local/lib/libopencv_stitching.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_stitching.2.4.dylib
-- Installing: /usr/local/lib/libopencv_stitching.dylib
-- Installing: /usr/local/include/opencv2/stitching.hpp
-- Installing: /usr/local/include/opencv2/stitching/stitcher.hpp
-- Installing: /usr/local/include/opencv2/stitching/warpers.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/autocalib.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/blenders.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/camera.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/exposure_compensate.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/matchers.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/motion_estimators.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/seam_finders.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/util.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/util_inl.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/warpers.hpp
-- Installing: /usr/local/include/opencv2/stitching/detail/warpers_inl.hpp
-- Installing: /usr/local/lib/libopencv_superres.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_superres.2.4.dylib
-- Installing: /usr/local/lib/libopencv_superres.dylib
-- Installing: /usr/local/include/opencv2/superres.hpp
-- Installing: /usr/local/include/opencv2/superres/optical_flow.hpp
-- Installing: /usr/local/include/opencv2/superres/superres.hpp
-- Installing: /usr/local/lib/libopencv_ts.a
-- Installing: /usr/local/include/opencv2/ts.hpp
-- Installing: /usr/local/include/opencv2/ts/gpu_perf.hpp
-- Installing: /usr/local/include/opencv2/ts/gpu_test.hpp
-- Installing: /usr/local/include/opencv2/ts/ts.hpp
-- Installing: /usr/local/include/opencv2/ts/ts_perf.hpp
-- Installing: /usr/local/include/opencv2/ts/ts_gtest.h
-- Installing: /usr/local/lib/libopencv_videostab.2.4.13.dylib
-- Installing: /usr/local/lib/libopencv_videostab.2.4.dylib
-- Installing: /usr/local/lib/libopencv_videostab.dylib
-- Installing: /usr/local/include/opencv2/videostab.hpp
-- Installing: /usr/local/include/opencv2/videostab/deblurring.hpp
-- Installing: /usr/local/include/opencv2/videostab/fast_marching.hpp
-- Installing: /usr/local/include/opencv2/videostab/fast_marching_inl.hpp
-- Installing: /usr/local/include/opencv2/videostab/frame_source.hpp
-- Installing: /usr/local/include/opencv2/videostab/global_motion.hpp
-- Installing: /usr/local/include/opencv2/videostab/inpainting.hpp
-- Installing: /usr/local/include/opencv2/videostab/log.hpp
-- Installing: /usr/local/include/opencv2/videostab/motion_stabilizing.hpp
-- Installing: /usr/local/include/opencv2/videostab/optical_flow.hpp
-- Installing: /usr/local/include/opencv2/videostab/stabilizer.hpp
-- Installing: /usr/local/include/opencv2/videostab/videostab.hpp
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_eye.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_eye_tree_eyeglasses.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalcatface.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalcatface_extended.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt2.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt_tree.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_fullbody.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_lefteye_2splits.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_licence_plate_rus_16stages.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_lowerbody.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_mcs_eyepair_big.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_mcs_eyepair_small.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_mcs_leftear.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_mcs_lefteye.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_mcs_mouth.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_mcs_nose.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_mcs_rightear.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_mcs_righteye.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_mcs_upperbody.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_profileface.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_righteye_2splits.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_russian_plate_number.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_smile.xml
-- Installing: /usr/local/share/OpenCV/haarcascades/haarcascade_upperbody.xml
-- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_frontalcatface.xml
-- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_frontalface.xml
-- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_profileface.xml
-- Installing: /usr/local/share/OpenCV/lbpcascades/lbpcascade_silverware.xml
-- Installing: /usr/local/bin/opencv_haartraining
-- Installing: /usr/local/bin/opencv_createsamples
-- Installing: /usr/local/bin/opencv_performance
-- Installing: /usr/local/bin/opencv_traincascade
-- Installing: /usr/local/bin/opencv_annotation
-- Installing: /usr/local/bin/opencv_visualisation

5. 以上表明Opencv2.4.13在MacOS系统中安装完毕。我们可以得知Opencv2.4.13的相关配置环境如下:

Opencv的INCLUDE文件路径为

INCLUDEPATH += /usr/local/include
INCLUDEPATH += /usr/local/include/opencv
INCLUDEPATH += /usr/local/include/opencv2

Opencv的LIB文件路径为

LIBS += -L/usr/local/lib

6. 配置Xcode(版本号:8.3.3)工程的Opencv调用

6.1 打开Xcode并新建工程,我们以RM_BigBuff工程项目为例进行说明:

6.2 根据如下图所示的操作顺序在项目的设置中,在其Search Paths一栏中进行相关的路径添加:

Header Search Paths一栏中添加:

I/usr/local/include
/usr/local/include/opencv

Library Search Paths一栏中添加:

/usr/local/lib


6.3 根据如下图红框所示的。在工程文件中,添加新的文件夹openCV_Frameworks存放Opencv2.4.13对应的dylib库:

6.4 运行工程文件检验Opencv是否配置成功。

One Reply to “MacOS Sierra 配置 OpenCV 2.4.13”

发表评论