编译OpenCV3.2.0时,ffmpeg或ippicv下载不成功的解决方案
在自己编译OpenCV3.2.0时,因为种种原因可能会导致ffmpeg或ippicv下载不成功的问题,可以通过手动配置来解决这类问题,当然也可以直接配置之后再编译。
在进行配置之前,首先前往GitHub下载相应的库。
链接打开之后页面内容大致如上图所示,图中圈出了ffmpeg和iipicv的不同版本,具体用哪一版就各取所需吧。明确版本之后点击相应的链接进入下载。(针对于OpenCV3.2.0版本,可前往进行下载ffmpeg和ippicv文件)
下载完成之后解压,位置不重要。
到此,准备完毕。
FFmpeg的配置
-
将“..\opencv_3rdparty-ffmpeg-master_20160715\ffmpeg” 目录中的 ffmpeg_version.cmake、opencv_ffmpeg.dll、opencv_ffmpeg_64.dll 三项复制到 “path to your OpenCV\opencv\sources\3rdparty\ffmpeg” 目录下。
将上图中的三项复制到下图的目录中 -
编辑 ffmpeg.cmake
在 “path to your OpenCV\opencv\sources\3rdparty\ffmpeg” 中打开文件 ffmpeg.cmake ,将其内容修改为:message(STATUS "FFMPEG: Package successfully downloaded") include(${CMAKE_CURRENT_LIST_DIR}/ffmpeg_version.cmake)
- 1
- 2
- 1
- 2
保存内容。
到此,ffmpeg配置完毕。
ippicv的配置
-
在前面下载解压的目录“..\opencv_3rdparty-ippicv-master_20151201\ippicv” 中将ippicv_windows_20151201.zip 解压到当前目录。
在 “path to your OpenCV \opencv\sources\3rdparty\ippicv” 中创建文件夹unpack,将解压得到的ippicv_win 复制到新创建的unpack 中。 -
编辑 downloader.cmake
将downloader.cmake 的内容修改为:
#
# The script downloads ICV package
#
# On return this will define:
# OPENCV_ICV_PATH - path to unpacked downloaded package
#
function(_icv_downloader)
# Commit SHA in the opencv_3rdparty repo
set(IPPICV_BINARIES_COMMIT "81a676001ca8075ada498583e4166079e5744668")
# Define actual ICV versions
if(APPLE)
set(OPENCV_ICV_PACKAGE_NAME "ippicv_macosx_20151201.tgz")
set(OPENCV_ICV_PACKAGE_HASH "4ff1fde9a7cfdfe7250bfcd8334e0f2f")
set(OPENCV_ICV_PLATFORM "macosx")
set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_osx")
elseif(UNIX)
if(ANDROID AND NOT (ANDROID_ABI STREQUAL x86 OR ANDROID_ABI STREQUAL x86_64))
return()
endif()
set(OPENCV_ICV_PACKAGE_NAME "ippicv_linux_20151201.tgz")
set(OPENCV_ICV_PACKAGE_HASH "808b791a6eac9ed78d32a7666804320e")
set(OPENCV_ICV_PLATFORM "linux")
set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_lnx")
elseif(WIN32 AND NOT ARM)
set(OPENCV_ICV_PACKAGE_NAME "ippicv_windows_20151201.zip")
set(OPENCV_ICV_PACKAGE_HASH "04e81ce5d0e329c3fbc606ae32cad44d")
set(OPENCV_ICV_PLATFORM "windows")
set(OPENCV_ICV_PACKAGE_SUBDIR "/ippicv_win")
else()
return() # Not supported
endif()
set(OPENCV_ICV_UNPACK_PATH "${CMAKE_CURRENT_LIST_DIR}/unpack")
set(OPENCV_ICV_PATH "${OPENCV_ICV_UNPACK_PATH}${OPENCV_ICV_PACKAGE_SUBDIR}")
message(STATUS "ICV: Package successfully downloaded")
set(OPENCV_ICV_PATH "${OPENCV_ICV_PATH}" PARENT_SCOPE)
endfunction()
_icv_downloader()
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
保存内容。
到此,ippicv配置完毕。
至此,已经完成了CMake过程中需要下载的相关文件下载及配置!点击configure即可完成编译,若编译完成为红色则再点一次configure按钮重编译一遍即可,然后点击generate即可生成工程文件!
本文转自:http://blog.csdn.net/yiyuehuan/article/details/52951574
上一篇: JMS规范介绍(1)JMS消息