Compare commits
226 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74e5ff2ec7 | |||
| 72e49dc790 | |||
| a2d27429e4 | |||
| 977562b614 | |||
| 3b6a82b57c | |||
| f89cc191a4 | |||
| 5163986e7d | |||
| 3400d83778 | |||
| 4c31c26acf | |||
| 09fe5cddf1 | |||
| 18b2d6bdbb | |||
| bcc086baa9 | |||
| 87b84a4197 | |||
| d51d05fc44 | |||
| 69127e4105 | |||
| 2b1e13f8f4 | |||
| 652606f780 | |||
| 80fed87d53 | |||
| a914088f29 | |||
| 6570215205 | |||
| c34820b53a | |||
| 1d7ff721ed | |||
| 579f723fc6 | |||
| 7c402d1e15 | |||
| e7885bb8e4 | |||
| 6f288615a2 | |||
| 6a0f605f51 | |||
| e22983ddb6 | |||
| 1e332d690f | |||
| fa64f28c6b | |||
| 35f75147b0 | |||
| 6aa4f533fa | |||
| 235a678458 | |||
| 382695ba5a | |||
| 36367ec027 | |||
| 2c57445ffe | |||
| eb3c9ed1ab | |||
| bf3264b197 | |||
| 1e9ed14205 | |||
| 17a914d2d0 | |||
| 0e53c56cf6 | |||
| eeaa1e8751 | |||
| 2122627877 | |||
| 18536fe8f9 | |||
| 91f6eb7cab | |||
| 795a513ac4 | |||
| a2d89aced4 | |||
| 6c58a22e32 | |||
| d7a7d05dd6 | |||
| a089cf8d9b | |||
| a2561ee0cd | |||
| 3929a43873 | |||
| 870563ba25 | |||
| 917138f565 | |||
| 7758322fd3 | |||
| 9d7e51eb46 | |||
| ecea583afd | |||
| 4703f4552a | |||
| 8d521d4704 | |||
| 656594ad4f | |||
| baa4882a2a | |||
| f9f1261469 | |||
| 74097a426b | |||
| 04f0d31472 | |||
| 727a339455 | |||
| 642d7d6826 | |||
| 9086efa8e9 | |||
| b47a2012d2 | |||
| 75ea10e6ff | |||
| 9aa29373b4 | |||
| f3254b28f2 | |||
| 10f6ebfdf7 | |||
| 10702c6d75 | |||
| e640985e22 | |||
| 2a1cf23fab | |||
| a3954fb223 | |||
| d619625576 | |||
| aebffb712a | |||
| 52fc9f7794 | |||
| 8e10cd8946 | |||
| f2fe89c6d8 | |||
| b62cf65b91 | |||
| 3d095ccc82 | |||
| d27d091e59 | |||
| 43f38df1d2 | |||
| 3c86788b1f | |||
| d2b093d809 | |||
| ce2284e2e6 | |||
| 5a4fa4607b | |||
| ae47b8f06c | |||
| 10774ff068 | |||
| b28677bd90 | |||
| 87bb7ff558 | |||
| 6bf0181d87 | |||
| ea5225ef3e | |||
| b08432cfe7 | |||
| e143706ef9 | |||
| f5c3cb8b7c | |||
| 7d37625fc3 | |||
| 56d62118d5 | |||
| b5dd26e4c7 | |||
| 924b0ef786 | |||
| c6cab50c5c | |||
| 09bc99a0c0 | |||
| c66cf08ced | |||
| cdddecbb93 | |||
| db17382d3a | |||
| de95a2b278 | |||
| 04a6ab4144 | |||
| f2ecf4f905 | |||
| 5539e85a11 | |||
| ad58c084a9 | |||
| 6f68640d4d | |||
| bbf43e8b16 | |||
| 6c99b5c9e5 | |||
| 6a6ae355b1 | |||
| 8ffc15371d | |||
| 7476bf5cd7 | |||
| 4dbd0f0e8f | |||
| 9698079ca5 | |||
| 0c19a07bf4 | |||
| d6f1ad8c14 | |||
| f36db3a037 | |||
| ad6aae4583 | |||
| 2c06e59a69 | |||
| f428d1874a | |||
| f7b40cdc63 | |||
| 7e495a1d66 | |||
| f282498b1d | |||
| 55c9a7c87d | |||
| 4d23e2c8c9 | |||
| 5810a73d30 | |||
| 5c327030eb | |||
| 04ec0bdbf0 | |||
| 7fa01e3fcc | |||
| 2be7d9b4d5 | |||
| ec8aec09ec | |||
| 2c9f651230 | |||
| c6eb7c3b12 | |||
| a4815cf359 | |||
| 38693ef37c | |||
| 5febc07b6b | |||
| f0b19d4659 | |||
| 3ef2e1136f | |||
| e01335bf47 | |||
| b6365699ee | |||
| 07cd18adaf | |||
| 8a962d348e | |||
| 172b4554f3 | |||
| 4331f76d18 | |||
| 4bd721ad3b | |||
| 73f5697749 | |||
| 1b4afcca30 | |||
| 77ad07adf3 | |||
| 7b8ad4cb04 | |||
| dd678121b3 | |||
| 1be58f9a00 | |||
| 6846f881a2 | |||
| 91ac9688a8 | |||
| d28df08eb0 | |||
| 2afad8b575 | |||
| 63a5587d0d | |||
| 7ec2b6bad0 | |||
| d756de176f | |||
| 1b10699996 | |||
| 40c26e21d2 | |||
| 33ff3d6016 | |||
| d87b709c26 | |||
| 0149969463 | |||
| b07bce11ef | |||
| 83def21ba9 | |||
| 99c49648fa | |||
| 321070ccf0 | |||
| ecdc7da6b1 | |||
| 429cd85b46 | |||
| 9a86245242 | |||
| 3d594c70ff | |||
| 24c614f686 | |||
| a06af5ca25 | |||
| b37d65ff2b | |||
| 0a65f2f4af | |||
| 79e0e948a7 | |||
| da00252963 | |||
| 3b065e38be | |||
| fd7bf0b766 | |||
| abc9ef6809 | |||
| fca1f006d8 | |||
| dc2bca0772 | |||
| 436d9bbcbb | |||
| e153f0631c | |||
| 819ac111a2 | |||
| 959a5c980d | |||
| 2bf3104ee5 | |||
| 1d626194af | |||
| 00d8ad9e7e | |||
| 18ca645fd2 | |||
| 4a237af814 | |||
| ecf770d49d | |||
| 5f3eb0fc49 | |||
| 34c7162104 | |||
| 06aff4e7b0 | |||
| 084385cf38 | |||
| 3a565e001e | |||
| f8985bb7fc | |||
| 1d3219747a | |||
| 632211eb27 | |||
| 980fc93b4d | |||
| d1a148b06f | |||
| 4ddf634c30 | |||
| ec8637a990 | |||
| 34998b6034 | |||
| 3f81a152b9 | |||
| 0f0a4c3099 | |||
| 8942eaf0d7 | |||
| 7f0d6d42f0 | |||
| 13f402a554 | |||
| 0e64baaec5 | |||
| de3767df0a | |||
| aaefd31844 | |||
| 23fb570cbd | |||
| 116d3be9c0 | |||
| bbac4bc4cf | |||
| 7a0d6f7733 | |||
| cf5e272878 | |||
| d8f538d67b | |||
| 7255ede3af |
@@ -122,15 +122,32 @@ file(GLOB lib_srcs "${tbb_src_dir}/src/tbb/*.cpp")
|
||||
file(GLOB lib_hdrs "${tbb_src_dir}/src/tbb/*.h")
|
||||
list(APPEND lib_srcs "${tbb_src_dir}/src/rml/client/rml_tbb.cpp")
|
||||
|
||||
add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required
|
||||
-D__TBB_BUILD=1 #required
|
||||
-D__TBB_SURVIVE_THREAD_SWITCH=0 #no cilk support
|
||||
-DUSE_PTHREAD #required for Unix
|
||||
-DTBB_USE_GCC_BUILTINS=1 #required for ARM GCC
|
||||
-DTBB_USE_DEBUG=0 #just to be sure
|
||||
-DTBB_NO_LEGACY=1 #don't need backward compatibility
|
||||
-DDO_ITT_NOTIFY=0 #it seems that we don't need these notifications
|
||||
)
|
||||
if (WIN32)
|
||||
add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0
|
||||
-D__TBB_BUILD=1
|
||||
-D_UNICODE
|
||||
-DUNICODE
|
||||
-DWINAPI_FAMILY=WINAPI_FAMILY_APP
|
||||
-DDO_ITT_NOTIFY=0
|
||||
) # defines were copied from windows.cl.inc
|
||||
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} /APPCONTAINER")
|
||||
else()
|
||||
add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required
|
||||
-D__TBB_BUILD=1 #required
|
||||
-D__TBB_SURVIVE_THREAD_SWITCH=0 #no cilk support
|
||||
-DTBB_USE_DEBUG=0 #just to be sure
|
||||
-DTBB_NO_LEGACY=1 #don't need backward compatibility
|
||||
-DDO_ITT_NOTIFY=0 #it seems that we don't need these notifications
|
||||
)
|
||||
endif()
|
||||
|
||||
if (HAVE_LIBPTHREAD)
|
||||
add_definitions(-DUSE_PTHREAD) #required for Unix
|
||||
endif()
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
add_definitions(-DTBB_USE_GCC_BUILTINS=1) #required for ARM GCC
|
||||
endif()
|
||||
|
||||
if(ANDROID_COMPILER_IS_CLANG)
|
||||
add_definitions(-D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1)
|
||||
@@ -145,7 +162,7 @@ endif()
|
||||
|
||||
set(TBB_SOURCE_FILES ${lib_srcs} ${lib_hdrs})
|
||||
|
||||
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
|
||||
if (ARM AND NOT WIN32)
|
||||
if (NOT ANDROID)
|
||||
set(TBB_SOURCE_FILES ${TBB_SOURCE_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/arm_linux_stub.cpp")
|
||||
endif()
|
||||
|
||||
@@ -118,32 +118,35 @@ OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT)
|
||||
OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (CMAKE_VERSION VERSION_GREATER "2.8" AND NOT ANDROID AND NOT IOS AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON)
|
||||
OCV_OPTION(WITH_VFW "Include Video for Windows support" ON IF WIN32 )
|
||||
OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS))
|
||||
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_IMAGEIO "ImageIO support for OS X" OFF IF APPLE)
|
||||
OCV_OPTION(WITH_IMAGEIO "ImageIO support for OS X" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF IF (MSVC OR X86 OR X86_64) )
|
||||
OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_JPEG "Include JPEG support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_JPEG "Include JPEG support" ON)
|
||||
OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_PNG "Include PNG support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_PNG "Include PNG support" ON)
|
||||
OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON IF WIN32 )
|
||||
OCV_OPTION(WITH_QUICKTIME "Use QuickTime for Video I/O insted of QTKit" OFF IF APPLE )
|
||||
OCV_OPTION(WITH_TBB "Include Intel TBB support" OFF IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF WIN32 )
|
||||
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_UNICAP "Include Unicap support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_VIDEOINPUT "Build HighGUI with DirectShow support" ON IF WIN32 )
|
||||
OCV_OPTION(WITH_DSHOW "Build HighGUI with DirectShow support" ON IF (WIN32 AND NOT ARM) )
|
||||
OCV_OPTION(WITH_MSMF "Build HighGUI with Media Foundation support" OFF IF WIN32 )
|
||||
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) )
|
||||
OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" OFF IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" OFF IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" OFF IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS) )
|
||||
|
||||
|
||||
# OpenCV build components
|
||||
@@ -169,7 +172,7 @@ OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 O
|
||||
OCV_OPTION(BUILD_JPEG "Build libjpeg from source" WIN32 OR ANDROID OR APPLE )
|
||||
OCV_OPTION(BUILD_PNG "Build libpng from source" WIN32 OR ANDROID OR APPLE )
|
||||
OCV_OPTION(BUILD_OPENEXR "Build openexr from source" WIN32 OR ANDROID OR APPLE )
|
||||
OCV_OPTION(BUILD_TBB "Download and build TBB from source" ANDROID IF CMAKE_COMPILER_IS_GNUCXX )
|
||||
OCV_OPTION(BUILD_TBB "Download and build TBB from source" ANDROID )
|
||||
|
||||
# OpenCV installation options
|
||||
# ===================================================
|
||||
@@ -412,15 +415,6 @@ endif()
|
||||
# --- OpenCL ---
|
||||
if(WITH_OPENCL)
|
||||
include(cmake/OpenCVDetectOpenCL.cmake)
|
||||
if(OPENCL_FOUND)
|
||||
set(HAVE_OPENCL 1)
|
||||
endif()
|
||||
if(WITH_OPENCLAMDFFT AND CLAMDFFT_INCLUDE_DIR)
|
||||
set(HAVE_CLAMDFFT 1)
|
||||
endif()
|
||||
if(WITH_OPENCLAMDBLAS AND CLAMDBLAS_INCLUDE_DIR)
|
||||
set(HAVE_CLAMDBLAS 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@@ -607,8 +601,8 @@ else()
|
||||
if(DEFINED WITH_QT)
|
||||
status(" QT 4.x:" NO)
|
||||
endif()
|
||||
if(WIN32)
|
||||
status(" Win32 UI:" YES)
|
||||
if(DEFINED WITH_WIN32UI)
|
||||
status(" Win32 UI:" HAVE_WIN32UI THEN YES ELSE NO)
|
||||
else()
|
||||
if(APPLE)
|
||||
if(WITH_CARBON)
|
||||
@@ -665,6 +659,10 @@ endif()
|
||||
status("")
|
||||
status(" Video I/O:")
|
||||
|
||||
if (DEFINED WITH_VFW)
|
||||
status(" Video for Windows:" HAVE_VFW THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_VFW)
|
||||
|
||||
if(DEFINED WITH_1394)
|
||||
status(" DC1394 1.x:" HAVE_DC1394 THEN "YES (ver ${ALIASOF_libdc1394_VERSION})" ELSE NO)
|
||||
status(" DC1394 2.x:" HAVE_DC1394_2 THEN "YES (ver ${ALIASOF_libdc1394-2_VERSION})" ELSE NO)
|
||||
@@ -747,9 +745,13 @@ if(DEFINED WITH_V4L)
|
||||
ELSE "${HAVE_CAMV4L_STR}/${HAVE_CAMV4L2_STR}")
|
||||
endif(DEFINED WITH_V4L)
|
||||
|
||||
if(DEFINED WITH_VIDEOINPUT)
|
||||
status(" DirectShow:" HAVE_VIDEOINPUT THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_VIDEOINPUT)
|
||||
if(DEFINED WITH_DSHOW)
|
||||
status(" DirectShow:" HAVE_DSHOW THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_DSHOW)
|
||||
|
||||
if(DEFINED WITH_MSMF)
|
||||
status(" Media Foundation:" HAVE_MSMF THEN YES ELSE NO)
|
||||
endif(DEFINED WITH_MSMF)
|
||||
|
||||
if(DEFINED WITH_XIMEA)
|
||||
status(" XIMEA:" HAVE_XIMEA THEN YES ELSE NO)
|
||||
@@ -791,17 +793,17 @@ if(HAVE_CUDA)
|
||||
status(" Use fast math:" CUDA_FAST_MATH THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
if(HAVE_OPENCL AND BUILD_opencv_ocl)
|
||||
if(HAVE_OPENCL)
|
||||
status("")
|
||||
status(" OpenCL")
|
||||
if(OPENCL_INCLUDE_DIR)
|
||||
status(" Include:" ${OPENCL_INCLUDE_DIR})
|
||||
status(" Include path:" ${OPENCL_INCLUDE_DIRS})
|
||||
endif()
|
||||
if(OPENCL_LIBRARIES)
|
||||
status(" libraries:" ${OPENCL_LIBRARIES})
|
||||
endif()
|
||||
status(" Use AMDFFT:" HAVE_CLAMDFFT THEN YES ELSE NO)
|
||||
status(" Use AMDBLAS:" HAVE_CLAMDBLAS THEN YES ELSE NO)
|
||||
status(" Use AMD FFT:" HAVE_CLAMDFFT THEN YES ELSE NO)
|
||||
status(" Use AMD BLAS:" HAVE_CLAMDBLAS THEN YES ELSE NO)
|
||||
endif()
|
||||
|
||||
# ========================== python ==========================
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2010-2011, Ethan Rublee
|
||||
# Copyright (c) 2011-2012, Andrey Kamaev
|
||||
# Copyright (c) 2011-2013, Andrey Kamaev
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@@ -281,8 +281,14 @@
|
||||
# [+] updated for NDK r8c
|
||||
# [+] added support for clang compiler
|
||||
# - December 2012
|
||||
# [+] suppress warning about unused CMAKE_TOOLCHAIN_FILE variable
|
||||
# [+] adjust API level to closest compatible as NDK does
|
||||
# [~] fixed ccache full path search
|
||||
# [+] updated for NDK r8d
|
||||
# [~] compiler options are aligned with NDK r8d
|
||||
# - March 2013
|
||||
# [+] updated for NDK r8e (x86 version)
|
||||
# [+] support x86_64 version of NDK
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
cmake_minimum_required( VERSION 2.6.3 )
|
||||
@@ -292,6 +298,10 @@ if( DEFINED CMAKE_CROSSCOMPILING )
|
||||
return()
|
||||
endif()
|
||||
|
||||
if( CMAKE_TOOLCHAIN_FILE )
|
||||
# touch toolchain variable only to suppress "unused variable" warning
|
||||
endif()
|
||||
|
||||
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
|
||||
if( _CMAKE_IN_TRY_COMPILE )
|
||||
include( "${CMAKE_CURRENT_SOURCE_DIR}/../android.toolchain.config.cmake" OPTIONAL )
|
||||
@@ -305,7 +315,7 @@ set( CMAKE_SYSTEM_VERSION 1 )
|
||||
# rpath makes low sence for Android
|
||||
set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )
|
||||
|
||||
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
|
||||
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
|
||||
if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
|
||||
if( CMAKE_HOST_WIN32 )
|
||||
file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
|
||||
@@ -449,19 +459,32 @@ if( ANDROID_FORBID_SYGWIN )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# detect current host platform
|
||||
if( NOT DEFINED ANDROID_NDK_HOST_X64 AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
|
||||
set( ANDROID_NDK_HOST_X64 1 CACHE BOOL "Try to use 64-bit compiler toolchain" )
|
||||
mark_as_advanced( ANDROID_NDK_HOST_X64 )
|
||||
endif()
|
||||
|
||||
set( TOOL_OS_SUFFIX "" )
|
||||
if( CMAKE_HOST_APPLE )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME "darwin-x86" )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME "darwin-x86_64" )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME2 "darwin-x86" )
|
||||
elseif( CMAKE_HOST_WIN32 )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME "windows" )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME "windows-x86_64" )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME2 "windows" )
|
||||
set( TOOL_OS_SUFFIX ".exe" )
|
||||
elseif( CMAKE_HOST_UNIX )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME "linux-x86" )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME "linux-x86_64" )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME2 "linux-x86" )
|
||||
else()
|
||||
message( FATAL_ERROR "Cross-compilation on your platform is not supported by this cmake toolchain" )
|
||||
endif()
|
||||
|
||||
if( NOT ANDROID_NDK_HOST_X64 )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} )
|
||||
endif()
|
||||
|
||||
# see if we have path to Android NDK
|
||||
__INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
|
||||
if( NOT ANDROID_NDK )
|
||||
@@ -509,7 +532,8 @@ if( ANDROID_NDK )
|
||||
endif()
|
||||
set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" FORCE )
|
||||
set( BUILD_WITH_ANDROID_NDK True )
|
||||
file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE LIMIT_COUNT 1 REGEX r[0-9]+[a-z]? )
|
||||
file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX r[0-9]+[a-z]? )
|
||||
string( REGEX MATCH r[0-9]+[a-z]? ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
|
||||
elseif( ANDROID_STANDALONE_TOOLCHAIN )
|
||||
get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
|
||||
# try to detect change
|
||||
@@ -563,22 +587,21 @@ if( BUILD_WITH_STANDALONE_TOOLCHAIN )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar )
|
||||
foreach( __toolchain ${${__availableToolchainsVar}} )
|
||||
macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst __host_system_name )
|
||||
foreach( __toolchain ${${__availableToolchainsLst}} )
|
||||
if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK}/toolchains/${__toolchain}/prebuilt/" )
|
||||
string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
|
||||
else()
|
||||
set( __gcc_toolchain "${__toolchain}" )
|
||||
endif()
|
||||
__DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK}/toolchains/${__gcc_toolchain}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
|
||||
__DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK}/toolchains/${__gcc_toolchain}/prebuilt/${__host_system_name}" )
|
||||
if( __machine )
|
||||
string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9]+)?$" __version "${__gcc_toolchain}" )
|
||||
string( REGEX MATCH "^[^-]+" __arch "${__gcc_toolchain}" )
|
||||
list( APPEND __availableToolchainMachines "${__machine}" )
|
||||
list( APPEND __availableToolchainArchs "${__arch}" )
|
||||
list( APPEND __availableToolchainCompilerVersions "${__version}" )
|
||||
else()
|
||||
list( REMOVE_ITEM ${__availableToolchainsVar} "${__toolchain}" )
|
||||
list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
|
||||
endif()
|
||||
unset( __gcc_toolchain )
|
||||
endforeach()
|
||||
@@ -594,17 +617,29 @@ if( BUILD_WITH_ANDROID_NDK )
|
||||
set( __availableToolchainCompilerVersions "" )
|
||||
if( ANDROID_TOOLCHAIN_NAME AND EXISTS "${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/" )
|
||||
# do not go through all toolchains if we know the name
|
||||
set( __availableToolchains "${ANDROID_TOOLCHAIN_NAME}" )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains )
|
||||
set( __availableToolchainsLst "${ANDROID_TOOLCHAIN_NAME}" )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst ${ANDROID_NDK_HOST_SYSTEM_NAME} )
|
||||
if( NOT __availableToolchains AND NOT ANDROID_NDK_HOST_SYSTEM_NAME STREQUAL ANDROID_NDK_HOST_SYSTEM_NAME2 )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst ${ANDROID_NDK_HOST_SYSTEM_NAME2} )
|
||||
if( __availableToolchains )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} )
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if( NOT __availableToolchains )
|
||||
file( GLOB __availableToolchains RELATIVE "${ANDROID_NDK}/toolchains" "${ANDROID_NDK}/toolchains/*" )
|
||||
file( GLOB __availableToolchainsLst RELATIVE "${ANDROID_NDK}/toolchains" "${ANDROID_NDK}/toolchains/*" )
|
||||
if( __availableToolchains )
|
||||
list(SORT __availableToolchains) # we need clang to go after gcc
|
||||
list(SORT __availableToolchainsLst) # we need clang to go after gcc
|
||||
endif()
|
||||
__LIST_FILTER( __availableToolchainsLst "^[.]" )
|
||||
__LIST_FILTER( __availableToolchainsLst "llvm" )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst ${ANDROID_NDK_HOST_SYSTEM_NAME} )
|
||||
if( NOT __availableToolchains AND NOT ANDROID_NDK_HOST_SYSTEM_NAME STREQUAL ANDROID_NDK_HOST_SYSTEM_NAME2 )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst ${ANDROID_NDK_HOST_SYSTEM_NAME2} )
|
||||
if( __availableToolchains )
|
||||
set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} )
|
||||
endif()
|
||||
endif()
|
||||
__LIST_FILTER( __availableToolchains "^[.]" )
|
||||
__LIST_FILTER( __availableToolchains "llvm" )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains )
|
||||
endif()
|
||||
if( NOT __availableToolchains )
|
||||
message( FATAL_ERROR "Could not find any working toolchain in the NDK. Probably your Android NDK is broken." )
|
||||
@@ -617,11 +652,11 @@ set( __uniqToolchainArchNames ${__availableToolchainArchs} )
|
||||
list( REMOVE_DUPLICATES __uniqToolchainArchNames )
|
||||
list( SORT __uniqToolchainArchNames )
|
||||
foreach( __arch ${__uniqToolchainArchNames} )
|
||||
list( APPEND ANDROID_SUPPORTED_ABIS ${ANDROID_SUPPORTED_ABIS_${__arch}} )
|
||||
list( APPEND ANDROID_SUPPORTED_ABIS ${ANDROID_SUPPORTED_ABIS_${__arch}} )
|
||||
endforeach()
|
||||
unset( __uniqToolchainArchNames )
|
||||
if( NOT ANDROID_SUPPORTED_ABIS )
|
||||
message( FATAL_ERROR "No one of known Android ABIs is supported by this cmake toolchain." )
|
||||
message( FATAL_ERROR "No one of known Android ABIs is supported by this cmake toolchain." )
|
||||
endif()
|
||||
|
||||
# choose target ABI
|
||||
@@ -760,11 +795,22 @@ unset( __availableToolchainCompilerVersions )
|
||||
# choose native API level
|
||||
__INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
|
||||
string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
|
||||
# TODO: filter out unsupported levels
|
||||
# adjust API level
|
||||
set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
|
||||
foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
|
||||
if( NOT __level GREATER ANDROID_NATIVE_API_LEVEL AND NOT __level LESS __real_api_level )
|
||||
set( __real_api_level ${__level} )
|
||||
endif()
|
||||
endforeach()
|
||||
if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level )
|
||||
message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
|
||||
set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
|
||||
endif()
|
||||
unset(__real_api_level)
|
||||
# validate
|
||||
list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx )
|
||||
if( __levelIdx EQUAL -1 )
|
||||
message( SEND_ERROR "Specified Android native API level (${ANDROID_NATIVE_API_LEVEL}) is not supported by your NDK/toolchain." )
|
||||
message( SEND_ERROR "Specified Android native API level 'android-${ANDROID_NATIVE_API_LEVEL}' is not supported by your NDK/toolchain." )
|
||||
else()
|
||||
if( BUILD_WITH_ANDROID_NDK )
|
||||
__DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
|
||||
@@ -926,7 +972,7 @@ elseif( "${ANDROID_TOOLCHAIN_NAME}" MATCHES "-clang3[.][0-9]?$" )
|
||||
string( REGEX MATCH "3[.][0-9]$" ANDROID_CLANG_VERSION "${ANDROID_TOOLCHAIN_NAME}")
|
||||
string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-4.6" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
|
||||
if( NOT EXISTS "${ANDROID_NDK}/toolchains/llvm-${ANDROID_CLANG_VERSION}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}/bin/clang${TOOL_OS_SUFFIX}" )
|
||||
message( FATAL_ERROR "Could not find the " )
|
||||
message( FATAL_ERROR "Could not find the Clang compiler driver" )
|
||||
endif()
|
||||
set( ANDROID_COMPILER_IS_CLANG 1 )
|
||||
set( ANDROID_CLANG_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/llvm-${ANDROID_CLANG_VERSION}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
|
||||
@@ -1140,38 +1186,52 @@ endif()
|
||||
|
||||
# NDK flags
|
||||
if( ARMEABI OR ARMEABI_V7A )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__" )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables" )
|
||||
if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
|
||||
# It is recommended to use the -mthumb compiler flag to force the generation
|
||||
# of 16-bit Thumb-1 instructions (the default being 32-bit ARM ones).
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "-mthumb" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "-marm -finline-limit=64" )
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "-mthumb -fomit-frame-pointer -fno-strict-aliasing" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "-marm -fno-omit-frame-pointer -fno-strict-aliasing" )
|
||||
if( NOT ANDROID_COMPILER_IS_CLANG )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -finline-limit=64" )
|
||||
endif()
|
||||
else()
|
||||
# always compile ARMEABI_V6 in arm mode; otherwise there is no difference from ARMEABI
|
||||
# O3 instead of O2/Os in release mode - like cmake sets for desktop gcc
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "-marm" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "-marm -finline-limit=300" )
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "-marm -fomit-frame-pointer -fstrict-aliasing" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "-marm -fno-omit-frame-pointer -fno-strict-aliasing" )
|
||||
if( NOT ANDROID_COMPILER_IS_CLANG )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
|
||||
endif()
|
||||
endif()
|
||||
elseif( X86 )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "-finline-limit=300" )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
|
||||
if( NOT ANDROID_COMPILER_IS_CLANG )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
|
||||
else()
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fPIC" )
|
||||
endif()
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "-fno-omit-frame-pointer -fno-strict-aliasing" )
|
||||
elseif( MIPS )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -frename-registers" )
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "-finline-limit=300 -fno-strict-aliasing" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "-finline-functions -fgcse-after-reload -frerun-cse-after-loop" )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "-fno-omit-frame-pointer" )
|
||||
if( NOT ANDROID_COMPILER_IS_CLANG )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers" )
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -funswitch-loops -finline-limit=300" )
|
||||
endif()
|
||||
elseif()
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "" )
|
||||
endif()
|
||||
|
||||
if( NOT X86 )
|
||||
set( ANDROID_CXX_FLAGS "-Wno-psabi ${ANDROID_CXX_FLAGS}" )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fsigned-char" ) # good/necessary when porting desktop libraries
|
||||
|
||||
if( NOT X86 AND NOT ANDROID_COMPILER_IS_CLANG )
|
||||
set( ANDROID_CXX_FLAGS "-Wno-psabi ${ANDROID_CXX_FLAGS}" )
|
||||
endif()
|
||||
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fsigned-char" ) # good/necessary when porting desktop libraries
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -fomit-frame-pointer" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "${ANDROID_CXX_FLAGS_DEBUG} -fno-strict-aliasing -fno-omit-frame-pointer" )
|
||||
if( NOT ANDROID_COMPILER_VERSION VERSION_LESS "4.6" )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -no-canonical-prefixes" ) # see https://android-review.googlesource.com/#/c/47564/
|
||||
endif()
|
||||
|
||||
# ABI-specific flags
|
||||
if( ARMEABI_V7A )
|
||||
@@ -1308,9 +1368,6 @@ if( ANDROID_COMPILER_IS_CLANG )
|
||||
set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS}" )
|
||||
endif()
|
||||
if( BUILD_WITH_ANDROID_NDK )
|
||||
if(ANDROID_ARCH_NAME STREQUAL "arm" )
|
||||
set( ANDROID_CXX_FLAGS "-isystem ${ANDROID_CLANG_TOOLCHAIN_ROOT}/lib/clang/${ANDROID_CLANG_VERSION}/include ${ANDROID_CXX_FLAGS}" )
|
||||
endif()
|
||||
set( ANDROID_CXX_FLAGS "-gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_CXX_FLAGS}" )
|
||||
endif()
|
||||
endif()
|
||||
@@ -1326,6 +1383,12 @@ set( CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "shared li
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "" CACHE STRING "module linker flags" )
|
||||
set( CMAKE_EXE_LINKER_FLAGS "-Wl,-z,nocopyreloc" CACHE STRING "executable linker flags" )
|
||||
|
||||
# put flags to cache (for debug purpose only)
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS}" CACHE INTERNAL "Android specific c/c++ flags" )
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE}" CACHE INTERNAL "Android specific c/c++ Release flags" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "${ANDROID_CXX_FLAGS_DEBUG}" CACHE INTERNAL "Android specific c/c++ Debug flags" )
|
||||
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS}" CACHE INTERNAL "Android specific c/c++ linker flags" )
|
||||
|
||||
# finish flags
|
||||
set( CMAKE_CXX_FLAGS "${ANDROID_CXX_FLAGS} ${CMAKE_CXX_FLAGS}" )
|
||||
set( CMAKE_C_FLAGS "${ANDROID_CXX_FLAGS} ${CMAKE_C_FLAGS}" )
|
||||
@@ -1456,6 +1519,7 @@ endmacro()
|
||||
if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
|
||||
set( __toolchain_config "")
|
||||
foreach( __var NDK_CCACHE LIBRARY_OUTPUT_PATH_ROOT ANDROID_FORBID_SYGWIN ANDROID_SET_OBSOLETE_VARIABLES
|
||||
ANDROID_NDK_HOST_X64
|
||||
ANDROID_NDK
|
||||
ANDROID_STANDALONE_TOOLCHAIN
|
||||
ANDROID_TOOLCHAIN_NAME
|
||||
@@ -1512,6 +1576,7 @@ endif()
|
||||
# ANDROID_NDK
|
||||
# ANDROID_STANDALONE_TOOLCHAIN
|
||||
# ANDROID_TOOLCHAIN_NAME : the NDK name of compiler toolchain
|
||||
# ANDROID_NDK_HOST_X64 : try to use x86_64 toolchain (default for x64 host systems)
|
||||
# LIBRARY_OUTPUT_PATH_ROOT : <any valid path>
|
||||
# NDK_CCACHE : <path to your ccache executable>
|
||||
# Obsolete:
|
||||
@@ -1536,7 +1601,7 @@ endif()
|
||||
# BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
|
||||
# ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
|
||||
# ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86" or "mips" depending on ANDROID_ABI
|
||||
# ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d; set only for NDK
|
||||
# ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e; set only for NDK
|
||||
# ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
|
||||
# ANDROID_SYSROOT : path to the compiler sysroot
|
||||
# TOOL_OS_SUFFIX : "" or ".exe" depending on host platform
|
||||
|
||||
@@ -51,3 +51,7 @@ OpenCV version constants
|
||||
.. data:: OPENCV_VERSION_2_4_4
|
||||
|
||||
OpenCV Library version 2.4.4
|
||||
|
||||
.. data:: OPENCV_VERSION_2_4_5
|
||||
|
||||
OpenCV Library version 2.4.5
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.opencv.engine"
|
||||
android:versionCode="26@ANDROID_PLATFORM_VERSION_CODE@"
|
||||
android:versionName="2.6" >
|
||||
android:versionCode="27@ANDROID_PLATFORM_VERSION_CODE@"
|
||||
android:versionName="2.7" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="@ANDROID_NATIVE_API_LEVEL@" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||
@@ -26,6 +26,5 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -163,22 +163,13 @@ int DetectKnownPlatforms()
|
||||
{
|
||||
int tegra_status = DetectTegra();
|
||||
|
||||
if (3 == tegra_status)
|
||||
// All Tegra platforms since Tegra3
|
||||
if (2 < tegra_status)
|
||||
{
|
||||
return PLATFORM_TEGRA3;
|
||||
return PLATFORM_TEGRA + tegra_status - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PLATFORM_UNKNOWN;
|
||||
}
|
||||
|
||||
// NOTE: Uncomment when all Tegras will be supported
|
||||
/*if (tegra_status > 0)
|
||||
* {
|
||||
* return PLATFORM_TEGRA + tegra_status - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return PLATFORM_UNKNOWN;
|
||||
}*/
|
||||
}
|
||||
@@ -27,6 +27,7 @@
|
||||
#define PLATFORM_TEGRA 1L
|
||||
#define PLATFORM_TEGRA2 2L
|
||||
#define PLATFORM_TEGRA3 3L
|
||||
#define PLATFORM_TEGRA4 4L
|
||||
|
||||
int DetectKnownPlatforms();
|
||||
int GetProcessorCount();
|
||||
|
||||
@@ -15,7 +15,7 @@ using namespace android;
|
||||
|
||||
const int OpenCVEngine::Platform = DetectKnownPlatforms();
|
||||
const int OpenCVEngine::CpuID = GetCpuID();
|
||||
const int OpenCVEngine::KnownVersions[] = {2040000, 2040100, 2040200, 2040300, 2040301, 2040302, 2040400};
|
||||
const int OpenCVEngine::KnownVersions[] = {2040000, 2040100, 2040200, 2040300, 2040301, 2040302, 2040400, 2040500};
|
||||
|
||||
bool OpenCVEngine::ValidateVersion(int version)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#define KERNEL_CONFIG_TEGRA_MAGIC "CONFIG_ARCH_TEGRA=y"
|
||||
#define KERNEL_CONFIG_TEGRA2_MAGIC "CONFIG_ARCH_TEGRA_2x_SOC=y"
|
||||
#define KERNEL_CONFIG_TEGRA3_MAGIC "CONFIG_ARCH_TEGRA_3x_SOC=y"
|
||||
#define KERNEL_CONFIG_TEGRA4_MAGIC "CONFIG_ARCH_TEGRA_11x_SOC=y"
|
||||
#define MAX_DATA_LEN 4096
|
||||
|
||||
int DetectTegra()
|
||||
@@ -19,9 +20,11 @@ int DetectTegra()
|
||||
const char *tegra_config = KERNEL_CONFIG_TEGRA_MAGIC;
|
||||
const char *tegra2_config = KERNEL_CONFIG_TEGRA2_MAGIC;
|
||||
const char *tegra3_config = KERNEL_CONFIG_TEGRA3_MAGIC;
|
||||
const char *tegra4_config = KERNEL_CONFIG_TEGRA4_MAGIC;
|
||||
int len = strlen(tegra_config);
|
||||
int len2 = strlen(tegra2_config);
|
||||
int len3 = strlen(tegra3_config);
|
||||
int len4 = strlen(tegra4_config);
|
||||
while (0 != gzgets(kernelConfig, tmpbuf, KERNEL_CONFIG_MAX_LINE_WIDTH))
|
||||
{
|
||||
if (0 == strncmp(tmpbuf, tegra_config, len))
|
||||
@@ -41,6 +44,11 @@ int DetectTegra()
|
||||
break;
|
||||
}
|
||||
|
||||
if (0 == strncmp(tmpbuf, tegra4_config, len4))
|
||||
{
|
||||
result = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
gzclose(kernelConfig);
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ std::vector<std::pair<int, int> > CommonPackageManager::InitArmRating()
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_NEON));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_TEGRA4, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -218,8 +219,8 @@ std::vector<std::pair<int, int> > CommonPackageManager::InitMipsRating()
|
||||
}
|
||||
|
||||
const std::vector<std::pair<int, int> > CommonPackageManager::ArchRatings[] = {
|
||||
CommonPackageManager::InitArmRating(),
|
||||
CommonPackageManager::InitIntelRating(),
|
||||
CommonPackageManager::InitArmRating(),
|
||||
CommonPackageManager::InitIntelRating(),
|
||||
CommonPackageManager::InitMipsRating()
|
||||
};
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ map<int, string> PackageInfo::InitPlatformNameMap()
|
||||
result[PLATFORM_TEGRA] = PLATFORM_TEGRA_NAME;
|
||||
result[PLATFORM_TEGRA2] = PLATFORM_TEGRA2_NAME;
|
||||
result[PLATFORM_TEGRA3] = PLATFORM_TEGRA3_NAME;
|
||||
result[PLATFORM_TEGRA4] = PLATFORM_TEGRA4_NAME;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -186,6 +187,10 @@ inline int SplitPlatfrom(const vector<string>& features)
|
||||
{
|
||||
result = PLATFORM_TEGRA3;
|
||||
}
|
||||
else if (PLATFORM_TEGRA4_NAME == tmp)
|
||||
{
|
||||
result = PLATFORM_TEGRA4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -425,6 +430,10 @@ InstallPath(install_path)
|
||||
{
|
||||
CpuID = ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON;
|
||||
} break;
|
||||
case PLATFORM_TEGRA4:
|
||||
{
|
||||
CpuID = ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#define ARCH_ARMv7_NAME "armv7a"
|
||||
#define ARCH_ARMv8_NAME "armv8"
|
||||
|
||||
|
||||
#define FEATURES_HAS_VFPv3d16_NAME "vfpv3d16"
|
||||
#define FEATURES_HAS_VFPv3_NAME "vfpv3"
|
||||
#define FEATURES_HAS_NEON_NAME "neon"
|
||||
@@ -25,7 +24,7 @@
|
||||
#define PLATFORM_TEGRA_NAME "tegra"
|
||||
#define PLATFORM_TEGRA2_NAME "tegra2"
|
||||
#define PLATFORM_TEGRA3_NAME "tegra3"
|
||||
|
||||
#define PLATFORM_TEGRA4_NAME "tegra4"
|
||||
|
||||
class PackageInfo
|
||||
{
|
||||
|
||||
@@ -201,6 +201,24 @@ TEST(OpenCVEngineTest, GetPathForCompatiblePackage2)
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(OpenCVEngineTest, GetPathForCompatiblePackage3)
|
||||
{
|
||||
sp<IOpenCVEngine> Engine = InitConnect();
|
||||
Starter.PackageManager->InstalledPackages.clear();
|
||||
Starter.PackageManager->InstallVersion(2040400, PLATFORM_TEGRA4, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON);
|
||||
EXPECT_FALSE(NULL == Engine.get());
|
||||
String16 result = Engine->GetLibPathByVersion(String16("2.4"));
|
||||
#ifdef __SUPPORT_TEGRA3
|
||||
EXPECT_STREQ("/data/data/org.opencv.lib_v24_tegra4/lib", String8(result).string());
|
||||
#else
|
||||
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
|
||||
EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv7a_neon/lib", String8(result).string());
|
||||
#else
|
||||
EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv7a/lib", String8(result).string());
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(OpenCVEngineTest, InstallAndGetVersion)
|
||||
{
|
||||
sp<IOpenCVEngine> Engine = InitConnect();
|
||||
@@ -276,7 +294,7 @@ TEST(OpenCVEngineTest, GetPathFor2_4_5)
|
||||
Starter.PackageManager->InstallVersion(2040500, PLATFORM_UNKNOWN, ARCH_ARMv7);
|
||||
EXPECT_FALSE(NULL == Engine.get());
|
||||
String16 result = Engine->GetLibPathByVersion(String16("2.4.5"));
|
||||
EXPECT_EQ(0, result.size()); // 2.4.5 is not published yet
|
||||
EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv7a/lib", String8(result).string());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -85,6 +85,21 @@ TEST(PackageInfo, FullNameTegra3)
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(PackageInfo, FullNameTegra4)
|
||||
{
|
||||
PackageInfo info(2040400, PLATFORM_TEGRA4, ARCH_ARMv7 | FEATURES_HAS_NEON);
|
||||
string name = info.GetFullName();
|
||||
#ifdef __SUPPORT_TEGRA3
|
||||
EXPECT_STREQ("org.opencv.lib_v24_tegra4", name.c_str());
|
||||
#else
|
||||
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
|
||||
EXPECT_STREQ("org.opencv.lib_v24_armv7a_neon", name.c_str());
|
||||
#else
|
||||
EXPECT_STREQ("org.opencv.lib_v24_armv7a", name.c_str());
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(PackageInfo, FullNameX86SSE2)
|
||||
{
|
||||
PackageInfo info(2030000, PLATFORM_UNKNOWN, ARCH_X86 | FEATURES_HAS_SSE2);
|
||||
@@ -148,6 +163,13 @@ TEST(PackageInfo, Tegra3FromFullName)
|
||||
EXPECT_EQ(PLATFORM_TEGRA3, info.GetPlatform());
|
||||
}
|
||||
|
||||
TEST(PackageInfo, Tegra4FromFullName)
|
||||
{
|
||||
PackageInfo info("org.opencv.lib_v24_tegra4", "/data/data/org.opencv.lib_v24_tegra4");
|
||||
EXPECT_EQ(2040000, info.GetVersion());
|
||||
EXPECT_EQ(PLATFORM_TEGRA4, info.GetPlatform());
|
||||
}
|
||||
|
||||
#ifdef __SUPPORT_MIPS
|
||||
TEST(PackageInfo, MipsFromFullName)
|
||||
{
|
||||
|
||||
@@ -102,6 +102,22 @@ TEST(PackageManager, GetPackagePathForTegra3)
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(PackageManager, GetPackagePathForTegra4)
|
||||
{
|
||||
PackageManagerStub pm;
|
||||
EXPECT_TRUE(pm.InstallVersion(2040400, PLATFORM_TEGRA4, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
|
||||
string path = pm.GetPackagePathByVersion(2040400, PLATFORM_TEGRA4, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON);
|
||||
#ifdef __SUPPORT_TEGRA3
|
||||
EXPECT_STREQ("/data/data/org.opencv.lib_v24_tegra4/lib", path.c_str());
|
||||
#else
|
||||
#ifdef __SUPPORT_ARMEABI_V7A_FEATURES
|
||||
EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv7a_neon/lib", path.c_str());
|
||||
#else
|
||||
EXPECT_STREQ("/data/data/org.opencv.lib_v24_armv7a/lib", path.c_str());
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __SUPPORT_MIPS
|
||||
TEST(PackageManager, GetPackagePathForMips)
|
||||
{
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-9
|
||||
target=android-8
|
||||
|
||||
@@ -33,6 +33,8 @@ public class HardwareDetector
|
||||
public static final int PLATFORM_TEGRA = 1;
|
||||
public static final int PLATFORM_TEGRA2 = 2;
|
||||
public static final int PLATFORM_TEGRA3 = 3;
|
||||
public static final int PLATFORM_TEGRA4 = 4;
|
||||
|
||||
|
||||
public static final int PLATFORM_UNKNOWN = 0;
|
||||
|
||||
|
||||
@@ -83,10 +83,14 @@ public class ManagerActivity extends Activity
|
||||
{
|
||||
HardwarePlatformView.setText("Tegra 2");
|
||||
}
|
||||
else
|
||||
else if (HardwareDetector.PLATFORM_TEGRA3 == Platfrom)
|
||||
{
|
||||
HardwarePlatformView.setText("Tegra 3");
|
||||
}
|
||||
else
|
||||
{
|
||||
HardwarePlatformView.setText("Tegra 4");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -367,10 +371,10 @@ public class ManagerActivity extends Activity
|
||||
temp.put("Version", NormalizeVersion(OpenCVersion, VersionName));
|
||||
// HACK: OpenCV Manager for Armv7-a Neon already has Tegra3 optimizations
|
||||
// that is enabled on proper hardware
|
||||
if (HardwareDetector.DetectKnownPlatforms() == HardwareDetector.PLATFORM_TEGRA3 &&
|
||||
if (HardwareDetector.DetectKnownPlatforms() >= HardwareDetector.PLATFORM_TEGRA3 &&
|
||||
HardwareName.equals("armv7a neon ") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
|
||||
{
|
||||
temp.put("Hardware", "Tegra 3");
|
||||
temp.put("Hardware", "Tegra");
|
||||
if (Tags == null)
|
||||
{
|
||||
Tags = "optimized";
|
||||
|
||||
@@ -14,20 +14,20 @@ manually using adb tool:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
adb install OpenCV-2.4.4-android-sdk/apk/OpenCV_2.4.4_Manager_2.6_<platform>.apk
|
||||
adb install OpenCV-2.4.5-android-sdk/apk/OpenCV_2.4.5_Manager_2.7_<platform>.apk
|
||||
|
||||
Use the table below to determine proper OpenCV Manager package for your device:
|
||||
|
||||
+------------------------------+--------------+---------------------------------------------------+
|
||||
| Hardware Platform | Android ver. | Package name |
|
||||
+==============================+==============+===================================================+
|
||||
| armeabi-v7a (ARMv7-A + NEON) | >= 2.3 | OpenCV_2.4.4_Manager_2.6_armv7a-neon.apk |
|
||||
| armeabi-v7a (ARMv7-A + NEON) | >= 2.3 | OpenCV_2.4.5_Manager_2.7_armv7a-neon.apk |
|
||||
+------------------------------+--------------+---------------------------------------------------+
|
||||
| armeabi-v7a (ARMv7-A + NEON) | = 2.2 | OpenCV_2.4.4_Manager_2.6_armv7a-neon-android8.apk |
|
||||
| armeabi-v7a (ARMv7-A + NEON) | = 2.2 | OpenCV_2.4.5_Manager_2.7_armv7a-neon-android8.apk |
|
||||
+------------------------------+--------------+---------------------------------------------------+
|
||||
| armeabi (ARMv5, ARMv6) | >= 2.3 | OpenCV_2.4.4_Manager_2.6_armeabi.apk |
|
||||
| armeabi (ARMv5, ARMv6) | >= 2.3 | OpenCV_2.4.5_Manager_2.7_armeabi.apk |
|
||||
+------------------------------+--------------+---------------------------------------------------+
|
||||
| Intel x86 | >= 2.3 | OpenCV_2.4.4_Manager_2.6_x86.apk |
|
||||
| Intel x86 | >= 2.3 | OpenCV_2.4.5_Manager_2.7_x86.apk |
|
||||
+------------------------------+--------------+---------------------------------------------------+
|
||||
| MIPS | >= 2.3 | OpenCV_2.4.4_Manager_2.6_mips.apk |
|
||||
| MIPS | >= 2.3 | OpenCV_2.4.5_Manager_2.7_mips.apk |
|
||||
+------------------------------+--------------+---------------------------------------------------+
|
||||
|
||||
@@ -264,13 +264,24 @@ macro(add_android_project target path)
|
||||
ocv_list_filterout(android_proj_jni_files "\\\\.svn")
|
||||
|
||||
if(android_proj_jni_files AND EXISTS ${path}/jni/Android.mk AND NOT DEFINED JNI_LIB_NAME)
|
||||
# find local module name in Android.mk file to build native lib
|
||||
file(STRINGS "${path}/jni/Android.mk" JNI_LIB_NAME REGEX "LOCAL_MODULE[ ]*:=[ ]*.*" )
|
||||
string(REGEX REPLACE "LOCAL_MODULE[ ]*:=[ ]*([a-zA-Z_][a-zA-Z_0-9]*)[ ]*" "\\1" JNI_LIB_NAME "${JNI_LIB_NAME}")
|
||||
|
||||
# find using of native app glue to determine native activity
|
||||
file(STRINGS "${path}/jni/Android.mk" NATIVE_APP_GLUE REGEX ".*(call import-module,android/native_app_glue)" )
|
||||
|
||||
if(JNI_LIB_NAME)
|
||||
ocv_include_modules_recurse(${android_proj_NATIVE_DEPS})
|
||||
ocv_include_directories("${path}/jni")
|
||||
|
||||
if (NATIVE_APP_GLUE)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
list(APPEND android_proj_jni_files ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes -Wunused-parameter -Wmissing-prototypes)
|
||||
set(android_proj_NATIVE_DEPS ${android_proj_NATIVE_DEPS} android)
|
||||
endif()
|
||||
|
||||
add_library(${JNI_LIB_NAME} MODULE ${android_proj_jni_files})
|
||||
target_link_libraries(${JNI_LIB_NAME} ${OPENCV_LINKER_LIBS} ${android_proj_NATIVE_DEPS})
|
||||
|
||||
|
||||
@@ -16,10 +16,16 @@ find_host_program(ANT_EXECUTABLE NAMES ${ANT_NAME})
|
||||
|
||||
if(ANT_EXECUTABLE)
|
||||
execute_process(COMMAND ${ANT_EXECUTABLE} -version
|
||||
RESULT_VARIABLE ANT_ERROR_LEVEL
|
||||
OUTPUT_VARIABLE ANT_VERSION_FULL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" ANT_VERSION "${ANT_VERSION_FULL}")
|
||||
set(ANT_VERSION "${ANT_VERSION}" CACHE INTERNAL "Detected ant vesion")
|
||||
if (ANT_ERROR_LEVEL)
|
||||
unset(ANT_EXECUTABLE)
|
||||
unset(ANT_EXECUTABLE CACHE)
|
||||
else()
|
||||
string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" ANT_VERSION "${ANT_VERSION_FULL}")
|
||||
set(ANT_VERSION "${ANT_VERSION}" CACHE INTERNAL "Detected ant vesion")
|
||||
|
||||
message(STATUS "Found apache ant ${ANT_VERSION}: ${ANT_EXECUTABLE}")
|
||||
message(STATUS "Found apache ant ${ANT_VERSION}: ${ANT_EXECUTABLE}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -57,7 +57,7 @@ if(CUDA_FOUND)
|
||||
elseif(CUDA_GENERATION STREQUAL "Kepler")
|
||||
set(__cuda_arch_bin "3.0")
|
||||
elseif(CUDA_GENERATION STREQUAL "Auto")
|
||||
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" "${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCudaArch.cu" "--run"
|
||||
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
|
||||
RESULT_VARIABLE _nvcc_res OUTPUT_VARIABLE _nvcc_out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
@@ -142,11 +142,14 @@ if(CUDA_FOUND)
|
||||
foreach(var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_DEBUG)
|
||||
set(${var}_backup_in_cuda_compile_ "${${var}}")
|
||||
|
||||
# we reomove /EHa as it leasd warnings under windows
|
||||
# we remove /EHa as it generates warnings under windows
|
||||
string(REPLACE "/EHa" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -ggdb3 flag as it leads to preprocessor errors when compiling CUDA files (CUDA 4.1)
|
||||
string(REPLACE "-ggdb3" "" ${var} "${${var}}")
|
||||
|
||||
# we remove -Wsign-promo as it generates warnings under linux
|
||||
string(REPLACE "-Wsign-promo" "" ${var} "${${var}}")
|
||||
endforeach()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
|
||||
@@ -93,14 +93,16 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
|
||||
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_TARGET_MACHINE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
|
||||
if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64")
|
||||
set(MINGW64 1)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" OR CMAKE_GENERATOR MATCHES "Visual Studio.*Win64")
|
||||
if(MINGW64 OR CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" OR CMAKE_GENERATOR MATCHES "Visual Studio.*Win64")
|
||||
set(X86_64 1)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
|
||||
set(X86 1)
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "arm.*|ARM.*")
|
||||
set(ARM 1)
|
||||
endif()
|
||||
|
||||
@@ -1,154 +1,104 @@
|
||||
if(APPLE)
|
||||
set(OPENCL_FOUND YES)
|
||||
set(OPENCL_LIBRARIES "-framework OpenCL")
|
||||
else()
|
||||
set(OPENCL_LIBRARY "-framework OpenCL" CACHE STRING "OpenCL library")
|
||||
set(OPENCL_INCLUDE_DIR "" CACHE STRING "OpenCL include directory")
|
||||
mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
|
||||
else(APPLE)
|
||||
find_package(OpenCL QUIET)
|
||||
if(WITH_OPENCLAMDFFT)
|
||||
set(CLAMDFFT_SEARCH_PATH $ENV{CLAMDFFT_PATH})
|
||||
if(NOT CLAMDFFT_SEARCH_PATH)
|
||||
if(WIN32)
|
||||
set( CLAMDFFT_SEARCH_PATH "C:\\Program Files (x86)\\AMD\\clAmdFft" )
|
||||
endif()
|
||||
endif()
|
||||
set( CLAMDFFT_INCLUDE_SEARCH_PATH ${CLAMDFFT_SEARCH_PATH}/include )
|
||||
if(UNIX)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CLAMDFFT_LIB_SEARCH_PATH /usr/lib)
|
||||
else()
|
||||
set(CLAMDFFT_LIB_SEARCH_PATH /usr/lib64)
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CLAMDFFT_LIB_SEARCH_PATH ${CLAMDFFT_SEARCH_PATH}\\lib32\\import)
|
||||
else()
|
||||
set(CLAMDFFT_LIB_SEARCH_PATH ${CLAMDFFT_SEARCH_PATH}\\lib64\\import)
|
||||
endif()
|
||||
endif()
|
||||
find_path(CLAMDFFT_INCLUDE_DIR
|
||||
NAMES clAmdFft.h
|
||||
PATHS ${CLAMDFFT_INCLUDE_SEARCH_PATH}
|
||||
PATH_SUFFIXES clAmdFft
|
||||
NO_DEFAULT_PATH)
|
||||
find_library(CLAMDFFT_LIBRARY
|
||||
NAMES clAmdFft.Runtime
|
||||
PATHS ${CLAMDFFT_LIB_SEARCH_PATH}
|
||||
NO_DEFAULT_PATH)
|
||||
if(CLAMDFFT_LIBRARY)
|
||||
set(CLAMDFFT_LIBRARIES ${CLAMDFFT_LIBRARY})
|
||||
else()
|
||||
set(CLAMDFFT_LIBRARIES "")
|
||||
endif()
|
||||
endif()
|
||||
if(WITH_OPENCLAMDBLAS)
|
||||
set(CLAMDBLAS_SEARCH_PATH $ENV{CLAMDBLAS_PATH})
|
||||
if(NOT CLAMDBLAS_SEARCH_PATH)
|
||||
if(WIN32)
|
||||
set( CLAMDBLAS_SEARCH_PATH "C:\\Program Files (x86)\\AMD\\clAmdBlas" )
|
||||
endif()
|
||||
endif()
|
||||
set( CLAMDBLAS_INCLUDE_SEARCH_PATH ${CLAMDBLAS_SEARCH_PATH}/include )
|
||||
if(UNIX)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CLAMDBLAS_LIB_SEARCH_PATH /usr/lib)
|
||||
else()
|
||||
set(CLAMDBLAS_LIB_SEARCH_PATH /usr/lib64)
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(CLAMDBLAS_LIB_SEARCH_PATH ${CLAMDBLAS_SEARCH_PATH}\\lib32\\import)
|
||||
else()
|
||||
set(CLAMDBLAS_LIB_SEARCH_PATH ${CLAMDBLAS_SEARCH_PATH}\\lib64\\import)
|
||||
endif()
|
||||
endif()
|
||||
find_path(CLAMDBLAS_INCLUDE_DIR
|
||||
NAMES clAmdBlas.h
|
||||
PATHS ${CLAMDBLAS_INCLUDE_SEARCH_PATH}
|
||||
PATH_SUFFIXES clAmdBlas
|
||||
NO_DEFAULT_PATH)
|
||||
find_library(CLAMDBLAS_LIBRARY
|
||||
NAMES clAmdBlas
|
||||
PATHS ${CLAMDBLAS_LIB_SEARCH_PATH}
|
||||
NO_DEFAULT_PATH)
|
||||
if(CLAMDBLAS_LIBRARY)
|
||||
set(CLAMDBLAS_LIBRARIES ${CLAMDBLAS_LIBRARY})
|
||||
else()
|
||||
set(CLAMDBLAS_LIBRARIES "")
|
||||
endif()
|
||||
endif()
|
||||
# Try AMD/ATI Stream SDK
|
||||
|
||||
if (NOT OPENCL_FOUND)
|
||||
set(ENV_AMDSTREAMSDKROOT $ENV{AMDAPPSDKROOT})
|
||||
set(ENV_AMDAPPSDKROOT $ENV{AMDAPPSDKROOT})
|
||||
set(ENV_OPENCLROOT $ENV{OPENCLROOT})
|
||||
set(ENV_CUDA_PATH $ENV{CUDA_PATH})
|
||||
set(ENV_INTELOCLSDKROOT $ENV{INTELOCLSDKROOT})
|
||||
if(ENV_AMDSTREAMSDKROOT)
|
||||
set(OPENCL_INCLUDE_SEARCH_PATH ${ENV_AMDAPPSDKROOT}/include)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_AMDAPPSDKROOT}/lib/x86)
|
||||
else()
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_AMDAPPSDKROOT}/lib/x86_64)
|
||||
endif()
|
||||
elseif(ENV_AMDSTREAMSDKROOT)
|
||||
set(OPENCL_INCLUDE_SEARCH_PATH ${ENV_AMDSTREAMSDKROOT}/include)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_AMDSTREAMSDKROOT}/lib/x86)
|
||||
else()
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_AMDSTREAMSDKROOT}/lib/x86_64)
|
||||
endif()
|
||||
elseif(ENV_CUDA_PATH AND WIN32)
|
||||
set(OPENCL_INCLUDE_SEARCH_PATH ${ENV_CUDA_PATH}/include)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_CUDA_PATH}/lib/Win32)
|
||||
else()
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_CUDA_PATH}/lib/x64)
|
||||
endif()
|
||||
elseif(ENV_OPENCLROOT AND UNIX)
|
||||
set(OPENCL_INCLUDE_SEARCH_PATH ${ENV_OPENCLROOT}/inc)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} /usr/lib)
|
||||
else()
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} /usr/lib64)
|
||||
endif()
|
||||
elseif(ENV_INTELOCLSDKROOT)
|
||||
set(OPENCL_INCLUDE_SEARCH_PATH ${ENV_INTELOCLSDKROOT}/include)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_INTELOCLSDKROOT}/lib/x86)
|
||||
else()
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_INTELOCLSDKROOT}/lib/x64)
|
||||
endif()
|
||||
find_path(OPENCL_ROOT_DIR
|
||||
NAMES OpenCL/cl.h CL/cl.h include/CL/cl.h include/nvidia-current/CL/cl.h
|
||||
PATHS ENV OCLROOT ENV AMDAPPSDKROOT ENV CUDA_PATH ENV INTELOCLSDKROOT
|
||||
DOC "OpenCL root directory"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path(OPENCL_INCLUDE_DIR
|
||||
NAMES OpenCL/cl.h CL/cl.h
|
||||
HINTS ${OPENCL_ROOT_DIR}
|
||||
PATH_SUFFIXES include include/nvidia-current
|
||||
DOC "OpenCL include directory")
|
||||
|
||||
if (X86_64)
|
||||
set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win64 lib/x86_64 lib/x64)
|
||||
elseif (X86)
|
||||
set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win32 lib/x86)
|
||||
endif()
|
||||
|
||||
if(OPENCL_INCLUDE_SEARCH_PATH)
|
||||
find_path(OPENCL_INCLUDE_DIR
|
||||
NAMES CL/cl.h OpenCL/cl.h
|
||||
PATHS ${OPENCL_INCLUDE_SEARCH_PATH}
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_path(OPENCL_INCLUDE_DIR
|
||||
NAMES CL/cl.h OpenCL/cl.h)
|
||||
endif()
|
||||
|
||||
if(OPENCL_LIB_SEARCH_PATH)
|
||||
find_library(OPENCL_LIBRARY NAMES OpenCL PATHS ${OPENCL_LIB_SEARCH_PATH} NO_DEFAULT_PATH)
|
||||
else()
|
||||
find_library(OPENCL_LIBRARY NAMES OpenCL)
|
||||
endif()
|
||||
find_library(OPENCL_LIBRARY
|
||||
NAMES OpenCL
|
||||
HINTS ${OPENCL_ROOT_DIR}
|
||||
PATH_SUFFIXES ${OPENCL_POSSIBLE_LIB_SUFFIXES}
|
||||
DOC "OpenCL library")
|
||||
|
||||
mark_as_advanced(OPENCL_INCLUDE_DIR OPENCL_LIBRARY)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
OPENCL
|
||||
DEFAULT_MSG
|
||||
OPENCL_LIBRARY OPENCL_INCLUDE_DIR
|
||||
)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENCL DEFAULT_MSG OPENCL_LIBRARY OPENCL_INCLUDE_DIR )
|
||||
endif()
|
||||
endif(APPLE)
|
||||
|
||||
if(OPENCL_FOUND)
|
||||
set(OPENCL_LIBRARIES ${OPENCL_LIBRARY})
|
||||
set(HAVE_OPENCL 1)
|
||||
else()
|
||||
set(OPENCL_LIBRARIES)
|
||||
if(OPENCL_FOUND)
|
||||
set(HAVE_OPENCL 1)
|
||||
set(OPENCL_INCLUDE_DIRS ${OPENCL_INCLUDE_DIR})
|
||||
set(OPENCL_LIBRARIES ${OPENCL_LIBRARY})
|
||||
|
||||
if (X86_64)
|
||||
set(CLAMD_POSSIBLE_LIB_SUFFIXES lib64/import)
|
||||
elseif (X86)
|
||||
set(CLAMD_POSSIBLE_LIB_SUFFIXES lib32/import)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCLAMDFFT)
|
||||
find_path(CLAMDFFT_ROOT_DIR
|
||||
NAMES include/clAmdFft.h
|
||||
PATHS ENV CLAMDFFT_PATH ENV ProgramFiles
|
||||
PATH_SUFFIXES clAmdFft AMD/clAmdFft
|
||||
DOC "AMD FFT root directory"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path(CLAMDFFT_INCLUDE_DIR
|
||||
NAMES clAmdFft.h
|
||||
HINTS ${CLAMDFFT_ROOT_DIR}
|
||||
PATH_SUFFIXES include
|
||||
DOC "clAmdFft include directory")
|
||||
|
||||
find_library(CLAMDFFT_LIBRARY
|
||||
NAMES clAmdFft.Runtime
|
||||
HINTS ${CLAMDFFT_ROOT_DIR}
|
||||
PATH_SUFFIXES ${CLAMD_POSSIBLE_LIB_SUFFIXES}
|
||||
DOC "clAmdFft library")
|
||||
|
||||
if(CLAMDFFT_LIBRARY AND CLAMDFFT_INCLUDE_DIR)
|
||||
set(HAVE_CLAMDFFT 1)
|
||||
list(APPEND OPENCL_INCLUDE_DIRS "${CLAMDFFT_INCLUDE_DIR}")
|
||||
list(APPEND OPENCL_LIBRARIES "${CLAMDFFT_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCLAMDBLAS)
|
||||
find_path(CLAMDBLAS_ROOT_DIR
|
||||
NAMES include/clAmdBlas.h
|
||||
PATHS ENV CLAMDFFT_PATH ENV ProgramFiles
|
||||
PATH_SUFFIXES clAmdBlas AMD/clAmdBlas
|
||||
DOC "AMD FFT root directory"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
find_path(CLAMDBLAS_INCLUDE_DIR
|
||||
NAMES clAmdBlas.h
|
||||
HINTS ${CLAMDBLAS_ROOT_DIR}
|
||||
PATH_SUFFIXES include
|
||||
DOC "clAmdFft include directory")
|
||||
|
||||
find_library(CLAMDBLAS_LIBRARY
|
||||
NAMES clAmdBlas
|
||||
HINTS ${CLAMDBLAS_ROOT_DIR}
|
||||
PATH_SUFFIXES ${CLAMD_POSSIBLE_LIB_SUFFIXES}
|
||||
DOC "clAmdBlas library")
|
||||
|
||||
if(CLAMDBLAS_LIBRARY AND CLAMDBLAS_INCLUDE_DIR)
|
||||
set(HAVE_CLAMDBLAS 1)
|
||||
list(APPEND OPENCL_INCLUDE_DIRS "${CLAMDBLAS_INCLUDE_DIR}")
|
||||
list(APPEND OPENCL_LIBRARIES "${CLAMDBLAS_LIBRARY}")
|
||||
endif()
|
||||
else()
|
||||
set(HAVE_OPENCL 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -13,57 +13,7 @@ endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Source package, for "make package_source"
|
||||
# ----------------------------------------------------------------------------
|
||||
if(BUILD_PACKAGE)
|
||||
set(TARBALL_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VERSION}")
|
||||
if (NOT WIN32)
|
||||
if(APPLE)
|
||||
set(TAR_CMD gnutar)
|
||||
else()
|
||||
set(TAR_CMD tar)
|
||||
endif()
|
||||
set(TAR_TRANSFORM "\"s,^,${TARBALL_NAME}/,\"")
|
||||
add_custom_target(package_source
|
||||
#TODO: maybe we should not remove dll's
|
||||
COMMAND ${TAR_CMD} --transform ${TAR_TRANSFORM} -cjpf ${CMAKE_CURRENT_BINARY_DIR}/${TARBALL_NAME}.tar.bz2 --exclude=".svn" --exclude=".git" --exclude="*.pyc" --exclude="*.vcproj" --exclude="*/lib/*" --exclude="*.dll" ./
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
else()
|
||||
add_custom_target(package_source
|
||||
COMMAND zip -9 -r ${CMAKE_CURRENT_BINARY_DIR}/${TARBALL_NAME}.zip . -x '*/.svn/*' '*/.git/*' '*.vcproj' '*.pyc'
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(package_source PROPERTIES FOLDER "extra")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# performance tests, for "make perf"
|
||||
# ----------------------------------------------------------------------------
|
||||
if(BUILD_PERF_TESTS AND PYTHON_EXECUTABLE)
|
||||
if(CMAKE_VERSION VERSION_GREATER "2.8.2")
|
||||
add_custom_target(perf
|
||||
${PYTHON_EXECUTABLE} "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" --configuration $<CONFIGURATION> "${CMAKE_BINARY_DIR}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
DEPENDS "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py"
|
||||
)
|
||||
else()
|
||||
add_custom_target(perf
|
||||
${PYTHON_EXECUTABLE} "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py" "${CMAKE_BINARY_DIR}"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
DEPENDS "${OpenCV_SOURCE_DIR}/modules/ts/misc/run.py"
|
||||
)
|
||||
endif()
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(perf PROPERTIES FOLDER "extra")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# spefial targets to build all OpenCV modules
|
||||
# target building all OpenCV modules
|
||||
# ----------------------------------------------------------------------------
|
||||
add_custom_target(opencv_modules)
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
@@ -72,7 +22,7 @@ endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# spefial targets to build all tests
|
||||
# targets building all tests
|
||||
# ----------------------------------------------------------------------------
|
||||
if(BUILD_TESTS)
|
||||
add_custom_target(opencv_tests)
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
# Detect 3rd-party GUI libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
#--- Win32 UI ---
|
||||
ocv_clear_vars(HAVE_WIN32UI)
|
||||
if(WITH_WIN32UI)
|
||||
TRY_COMPILE(HAVE_WIN32UI
|
||||
"${OPENCV_BINARY_DIR}/CMakeFiles/CMakeTmp"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/win32uitest.cpp"
|
||||
CMAKE_FLAGS "\"user32.lib\" \"gdi32.lib\""
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
endif(WITH_WIN32UI)
|
||||
|
||||
# --- QT4 ---
|
||||
ocv_clear_vars(HAVE_QT)
|
||||
if(WITH_QT)
|
||||
@@ -25,7 +35,7 @@ endif()
|
||||
# --- OpenGl ---
|
||||
ocv_clear_vars(HAVE_OPENGL HAVE_QT_OPENGL)
|
||||
if(WITH_OPENGL)
|
||||
if(WIN32 OR QT_QTOPENGL_FOUND OR HAVE_GTKGLEXT)
|
||||
if(WITH_WIN32UI OR (HAVE_QT AND QT_QTOPENGL_FOUND) OR HAVE_GTKGLEXT)
|
||||
find_package (OpenGL QUIET)
|
||||
if(OPENGL_FOUND)
|
||||
set(HAVE_OPENGL TRUE)
|
||||
|
||||
@@ -67,7 +67,7 @@ if(NOT TIFF_VERSION_STRING AND TIFF_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
# --- libjpeg (optional) ---
|
||||
if(WITH_JPEG)
|
||||
if(WITH_JPEG AND NOT IOS)
|
||||
if(BUILD_JPEG)
|
||||
ocv_clear_vars(JPEG_FOUND)
|
||||
else()
|
||||
@@ -110,12 +110,13 @@ if(NOT JASPER_VERSION_STRING)
|
||||
endif()
|
||||
|
||||
# --- libpng (optional, should be searched after zlib) ---
|
||||
if(WITH_PNG)
|
||||
if(WITH_PNG AND NOT IOS)
|
||||
if(BUILD_PNG)
|
||||
ocv_clear_vars(PNG_FOUND)
|
||||
else()
|
||||
include(FindPNG)
|
||||
if(PNG_FOUND)
|
||||
include(CheckIncludeFile)
|
||||
check_include_file("${PNG_PNG_INCLUDE_DIR}/png.h" HAVE_PNG_H)
|
||||
check_include_file("${PNG_PNG_INCLUDE_DIR}/libpng/png.h" HAVE_LIBPNG_PNG_H)
|
||||
if(HAVE_PNG_H)
|
||||
|
||||
@@ -49,8 +49,9 @@ endif()
|
||||
# --- OpenMP ---
|
||||
if(NOT HAVE_TBB AND NOT HAVE_CSTRIPES)
|
||||
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/omptest.cpp")
|
||||
FILE(WRITE "${_fname}" "#ifndef _OPENMP\n#error\n#endif\nint main() { return 0; }\n")
|
||||
TRY_COMPILE(HAVE_OPENMP "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp" "${_fname}")
|
||||
file(WRITE "${_fname}" "#ifndef _OPENMP\n#error\n#endif\nint main() { return 0; }\n")
|
||||
try_compile(HAVE_OPENMP "${CMAKE_BINARY_DIR}" "${_fname}")
|
||||
file(REMOVE "${_fname}")
|
||||
else()
|
||||
set(HAVE_OPENMP 0)
|
||||
endif()
|
||||
@@ -65,8 +66,9 @@ endif()
|
||||
# --- Concurrency ---
|
||||
if(MSVC AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES AND NOT HAVE_OPENMP)
|
||||
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/concurrencytest.cpp")
|
||||
FILE(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n")
|
||||
TRY_COMPILE(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp" "${_fname}")
|
||||
file(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n")
|
||||
try_compile(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}" "${_fname}")
|
||||
file(REMOVE "${_fname}")
|
||||
else()
|
||||
set(HAVE_CONCURRENCY 0)
|
||||
endif()
|
||||
|
||||
@@ -2,6 +2,15 @@
|
||||
# Detect 3rd-party video IO libraries
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
ocv_clear_vars(HAVE_VFW)
|
||||
if (WITH_VFW)
|
||||
TRY_COMPILE(HAVE_VFW
|
||||
"${OPENCV_BINARY_DIR}/CMakeFiles/CMakeTmp"
|
||||
"${OpenCV_SOURCE_DIR}/cmake/checks/vfwtest.cpp"
|
||||
CMAKE_FLAGS "-DLINK_LIBRARIES:STRING=vfw32"
|
||||
OUTPUT_VARIABLE OUTPUT)
|
||||
endif(WITH_VFW)
|
||||
|
||||
# --- GStreamer ---
|
||||
ocv_clear_vars(HAVE_GSTREAMER)
|
||||
if(WITH_GSTREAMER)
|
||||
@@ -37,7 +46,7 @@ if(WITH_PVAPI)
|
||||
set(PVAPI_SDK_SUBDIR x86)
|
||||
elseif(X86_64)
|
||||
set(PVAPI_SDK_SUBDIR x64)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES arm)
|
||||
elseif(ARM)
|
||||
set(PVAPI_SDK_SUBDIR arm)
|
||||
endif()
|
||||
|
||||
@@ -111,7 +120,7 @@ endif(WITH_XIMEA)
|
||||
# --- FFMPEG ---
|
||||
ocv_clear_vars(HAVE_FFMPEG HAVE_FFMPEG_CODEC HAVE_FFMPEG_FORMAT HAVE_FFMPEG_UTIL HAVE_FFMPEG_SWSCALE HAVE_GENTOO_FFMPEG HAVE_FFMPEG_FFMPEG)
|
||||
if(WITH_FFMPEG)
|
||||
if(WIN32)
|
||||
if(WIN32 AND NOT ARM)
|
||||
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg_version.cmake")
|
||||
elseif(UNIX)
|
||||
CHECK_MODULE(libavcodec HAVE_FFMPEG_CODEC)
|
||||
@@ -175,11 +184,16 @@ if(WITH_FFMPEG)
|
||||
endif(APPLE)
|
||||
endif(WITH_FFMPEG)
|
||||
|
||||
# --- VideoInput ---
|
||||
if(WITH_VIDEOINPUT)
|
||||
# --- VideoInput/DirectShow ---
|
||||
if(WITH_DSHOW)
|
||||
# always have VideoInput on Windows
|
||||
set(HAVE_VIDEOINPUT 1)
|
||||
endif(WITH_VIDEOINPUT)
|
||||
set(HAVE_DSHOW 1)
|
||||
endif(WITH_DSHOW)
|
||||
|
||||
# --- VideoInput/Microsoft Media Foundation ---
|
||||
if(WITH_MSMF)
|
||||
check_include_file(Mfapi.h HAVE_MSMF)
|
||||
endif(WITH_MSMF)
|
||||
|
||||
# --- Extra HighGUI libs on Windows ---
|
||||
if(WIN32)
|
||||
|
||||
@@ -12,6 +12,7 @@ endmacro()
|
||||
ocv_legacy_option(BUILD_NEW_PYTHON_SUPPORT BUILD_opencv_python)
|
||||
ocv_legacy_option(BUILD_JAVA_SUPPORT BUILD_opencv_java)
|
||||
ocv_legacy_option(WITH_ANDROID_CAMERA BUILD_opencv_androidcamera)
|
||||
ocv_legacy_option(WITH_VIDEOINPUT WITH_DSHOW)
|
||||
|
||||
if(DEFINED OPENCV_BUILD_3RDPARTY_LIBS)
|
||||
set(BUILD_ZLIB ${OPENCV_BUILD_3RDPARTY_LIBS} CACHE BOOL "Set via depricated OPENCV_BUILD_3RDPARTY_LIBS" FORCE)
|
||||
|
||||
@@ -432,10 +432,22 @@ macro(ocv_glob_module_sources)
|
||||
file(GLOB lib_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h")
|
||||
file(GLOB lib_hdrs_detail "include/opencv2/${name}/detail/*.hpp" "include/opencv2/${name}/detail/*.h")
|
||||
|
||||
file(GLOB cl_kernels "src/opencl/*.cl")
|
||||
|
||||
source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs})
|
||||
source_group("Include" FILES ${lib_hdrs})
|
||||
source_group("Include\\detail" FILES ${lib_hdrs_detail})
|
||||
|
||||
if(HAVE_OPENCL AND cl_kernels)
|
||||
ocv_include_directories(${OPENCL_INCLUDE_DIRS})
|
||||
add_custom_command(
|
||||
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp"
|
||||
COMMAND ${CMAKE_COMMAND} -DCL_DIR="${CMAKE_CURRENT_SOURCE_DIR}/src/opencl" -DOUTPUT="${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp" -P "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake"
|
||||
DEPENDS ${cl_kernels} "${OpenCV_SOURCE_DIR}/cmake/cl2cpp.cmake")
|
||||
source_group("Src\\OpenCL" FILES ${cl_kernels} "${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp")
|
||||
list(APPEND lib_srcs ${cl_kernels} "${CMAKE_CURRENT_BINARY_DIR}/kernels.cpp")
|
||||
endif()
|
||||
|
||||
ocv_set_module_sources(${ARGN} HEADERS ${lib_hdrs} ${lib_hdrs_detail} SOURCES ${lib_srcs} ${lib_int_hdrs})
|
||||
endmacro()
|
||||
|
||||
@@ -449,6 +461,9 @@ macro(ocv_create_module)
|
||||
|
||||
if(NOT "${ARGN}" STREQUAL "SKIP_LINK")
|
||||
target_link_libraries(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${OPENCV_MODULE_${the_module}_DEPS_EXT} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${ARGN})
|
||||
if(HAVE_OPENCL AND OPENCL_LIBRARIES)
|
||||
target_link_libraries(${the_module} ${OPENCL_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_dependencies(opencv_modules ${the_module})
|
||||
@@ -620,9 +635,6 @@ function(ocv_add_perf_tests)
|
||||
|
||||
ocv_add_precompiled_headers(${the_target})
|
||||
|
||||
if (PYTHON_EXECUTABLE)
|
||||
add_dependencies(perf ${the_target})
|
||||
endif()
|
||||
else(OCV_DEPENDENCIES_FOUND)
|
||||
# TODO: warn about unsatisfied dependencies
|
||||
endif(OCV_DEPENDENCIES_FOUND)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <vfw.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
AVIFileInit();
|
||||
AVIFileExit();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <windows.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
CreateWindow(NULL /*lpClassName*/, NULL /*lpWindowName*/, 0 /*dwStyle*/, 0 /*x*/,
|
||||
0 /*y*/, 0 /*nWidth*/, 0 /*nHeight*/, NULL /*hWndParent*/, NULL /*hMenu*/,
|
||||
NULL /*hInstance*/, NULL /*lpParam*/);
|
||||
DeleteDC(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -18,6 +18,7 @@ foreach(cl ${cl_list})
|
||||
string(REPLACE "\t" " " lines "${lines}")
|
||||
|
||||
string(REGEX REPLACE "/\\*([^*]/|\\*[^/]|[^*/])*\\*/" "" lines "${lines}") # multiline comments
|
||||
string(REGEX REPLACE "/\\*([^\n])*\\*/" "" lines "${lines}") # single-line comments
|
||||
string(REGEX REPLACE "[ ]*//[^\n]*\n" "\n" lines "${lines}") # single-line comments
|
||||
string(REGEX REPLACE "\n[ ]*(\n[ ]*)*" "\n" lines "${lines}") # empty lines & leading whitespace
|
||||
string(REGEX REPLACE "^\n" "" lines "${lines}") # leading new line
|
||||
@@ -13,6 +13,9 @@
|
||||
*/
|
||||
#cmakedefine HAVE_ALLOCA_H 1
|
||||
|
||||
/* Video for Windows support */
|
||||
#cmakedefine HAVE_VFW
|
||||
|
||||
/* V4L capturing support */
|
||||
#cmakedefine HAVE_CAMV4L
|
||||
|
||||
@@ -55,6 +58,9 @@
|
||||
/* GTK+ 2.0 Thread support */
|
||||
#cmakedefine HAVE_GTHREAD
|
||||
|
||||
/* Win32 UI */
|
||||
#cmakedefine HAVE_WIN32UI
|
||||
|
||||
/* GTK+ 2.x toolkit */
|
||||
#cmakedefine HAVE_GTK
|
||||
|
||||
@@ -208,8 +214,11 @@
|
||||
/* AMD's Basic Linear Algebra Subprograms Library*/
|
||||
#cmakedefine HAVE_CLAMDBLAS
|
||||
|
||||
/* VideoInput library */
|
||||
#cmakedefine HAVE_VIDEOINPUT
|
||||
/* DirectShow Video Capture library */
|
||||
#cmakedefine HAVE_DSHOW
|
||||
|
||||
/* Microsoft Media Foundation Capture library */
|
||||
#cmakedefine HAVE_MSMF
|
||||
|
||||
/* XIMEA camera support */
|
||||
#cmakedefine HAVE_XIMEA
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
{% if theme_lang == 'c' %}
|
||||
{% endif %}
|
||||
{% if theme_lang == 'cpp' %}
|
||||
<li>Try the <a href="http://opencv.willowgarage.com/wiki/Welcome?action=AttachFile&do=get&target=opencv_cheatsheet.pdf">Cheatsheet</a>.</li>
|
||||
<li>Try the <a href="http://docs.opencv.org/trunk/opencv_cheatsheet.pdf">Cheatsheet</a>.</li>
|
||||
{% endif %}
|
||||
{% if theme_lang == 'py' %}
|
||||
<li>Try the <a href="cookbook.html">Cookbook</a>.</li>
|
||||
|
||||
@@ -13,7 +13,7 @@ In this tutorial you will learn how to:
|
||||
* Use the :descriptor_extractor:`DescriptorExtractor<>` interface in order to find the feature vector correspondent to the keypoints. Specifically:
|
||||
|
||||
* Use :surf_descriptor_extractor:`SurfDescriptorExtractor<>` and its function :descriptor_extractor:`compute<>` to perform the required calculations.
|
||||
* Use a :brute_force_matcher:`BruteForceMatcher<>` to match the features vector
|
||||
* Use a :brute_force_matcher:`BFMatcher<>` to match the features vector
|
||||
* Use the function :draw_matches:`drawMatches<>` to draw the detected matches.
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
extractor.compute( img_2, keypoints_2, descriptors_2 );
|
||||
|
||||
//-- Step 3: Matching descriptor vectors with a brute force matcher
|
||||
BruteForceMatcher< L2<float> > matcher;
|
||||
BFMatcher matcher(NORM_L2);
|
||||
std::vector< DMatch > matches;
|
||||
matcher.match( descriptors_1, descriptors_2, matches );
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ The structure of package contents looks as follows:
|
||||
|
||||
::
|
||||
|
||||
OpenCV-2.4.4-android-sdk
|
||||
OpenCV-2.4.5-android-sdk
|
||||
|_ apk
|
||||
| |_ OpenCV_2.4.4_binary_pack_armv7a.apk
|
||||
| |_ OpenCV_2.4.4_Manager_2.6_XXX.apk
|
||||
| |_ OpenCV_2.4.5_binary_pack_armv7a.apk
|
||||
| |_ OpenCV_2.4.5_Manager_2.7_XXX.apk
|
||||
|
|
||||
|_ doc
|
||||
|_ samples
|
||||
@@ -157,10 +157,10 @@ Get the OpenCV4Android SDK
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
unzip ~/Downloads/OpenCV-2.4.4-android-sdk.zip
|
||||
unzip ~/Downloads/OpenCV-2.4.5-android-sdk.zip
|
||||
|
||||
.. |opencv_android_bin_pack| replace:: :file:`OpenCV-2.4.4-android-sdk.zip`
|
||||
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.4/OpenCV-2.4.4-android-sdk.zip/download
|
||||
.. |opencv_android_bin_pack| replace:: :file:`OpenCV-2.4.5-android-sdk.zip`
|
||||
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.5/OpenCV-2.4.5-android-sdk.zip/download
|
||||
.. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack|
|
||||
.. |seven_zip| replace:: 7-Zip
|
||||
.. _seven_zip: http://www.7-zip.org/
|
||||
@@ -295,7 +295,7 @@ Well, running samples from Eclipse is very simple:
|
||||
.. code-block:: sh
|
||||
:linenos:
|
||||
|
||||
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.4_Manager_2.6_armv7a-neon.apk
|
||||
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.5_Manager_2.7_armv7a-neon.apk
|
||||
|
||||
.. note:: ``armeabi``, ``armv7a-neon``, ``arm7a-neon-android8``, ``mips`` and ``x86`` stand for
|
||||
platform targets:
|
||||
|
||||
@@ -55,14 +55,14 @@ Manager to access OpenCV libraries externally installed in the target system.
|
||||
:guilabel:`File -> Import -> Existing project in your workspace`.
|
||||
|
||||
Press :guilabel:`Browse` button and locate OpenCV4Android SDK
|
||||
(:file:`OpenCV-2.4.4-android-sdk/sdk`).
|
||||
(:file:`OpenCV-2.4.5-android-sdk/sdk`).
|
||||
|
||||
.. image:: images/eclipse_opencv_dependency0.png
|
||||
:alt: Add dependency from OpenCV library
|
||||
:align: center
|
||||
|
||||
#. In application project add a reference to the OpenCV Java SDK in
|
||||
:guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.4``.
|
||||
:guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.5``.
|
||||
|
||||
.. image:: images/eclipse_opencv_dependency1.png
|
||||
:alt: Add dependency from OpenCV library
|
||||
@@ -101,7 +101,7 @@ See the "15-puzzle" OpenCV sample for details.
|
||||
public void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);
|
||||
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_5, this, mLoaderCallback);
|
||||
}
|
||||
|
||||
...
|
||||
@@ -128,27 +128,27 @@ described above.
|
||||
#. Add the OpenCV library project to your workspace the same way as for the async initialization
|
||||
above. Use menu :guilabel:`File -> Import -> Existing project in your workspace`,
|
||||
press :guilabel:`Browse` button and select OpenCV SDK path
|
||||
(:file:`OpenCV-2.4.4-android-sdk/sdk`).
|
||||
(:file:`OpenCV-2.4.5-android-sdk/sdk`).
|
||||
|
||||
.. image:: images/eclipse_opencv_dependency0.png
|
||||
:alt: Add dependency from OpenCV library
|
||||
:align: center
|
||||
|
||||
#. In the application project add a reference to the OpenCV4Android SDK in
|
||||
:guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.4``;
|
||||
:guilabel:`Project -> Properties -> Android -> Library -> Add` select ``OpenCV Library - 2.4.5``;
|
||||
|
||||
.. image:: images/eclipse_opencv_dependency1.png
|
||||
:alt: Add dependency from OpenCV library
|
||||
:align: center
|
||||
|
||||
#. If your application project **doesn't have a JNI part**, just copy the corresponding OpenCV
|
||||
native libs from :file:`<OpenCV-2.4.4-android-sdk>/sdk/native/libs/<target_arch>` to your
|
||||
native libs from :file:`<OpenCV-2.4.5-android-sdk>/sdk/native/libs/<target_arch>` to your
|
||||
project directory to folder :file:`libs/<target_arch>`.
|
||||
|
||||
In case of the application project **with a JNI part**, instead of manual libraries copying you
|
||||
need to modify your ``Android.mk`` file:
|
||||
add the following two code lines after the ``"include $(CLEAR_VARS)"`` and before
|
||||
``"include path_to_OpenCV-2.4.4-android-sdk/sdk/native/jni/OpenCV.mk"``
|
||||
``"include path_to_OpenCV-2.4.5-android-sdk/sdk/native/jni/OpenCV.mk"``
|
||||
|
||||
.. code-block:: make
|
||||
:linenos:
|
||||
@@ -221,7 +221,7 @@ taken:
|
||||
|
||||
.. code-block:: make
|
||||
|
||||
include C:\Work\OpenCV4Android\OpenCV-2.4.4-android-sdk\sdk\native\jni\OpenCV.mk
|
||||
include C:\Work\OpenCV4Android\OpenCV-2.4.5-android-sdk\sdk\native\jni\OpenCV.mk
|
||||
|
||||
Should be inserted into the :file:`jni/Android.mk` file **after** this line:
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
Introduction to Java Development
|
||||
********************************
|
||||
|
||||
Last updated: 28 February, 2013.
|
||||
|
||||
As of OpenCV 2.4.4, OpenCV supports desktop Java development using nearly the same interface as for
|
||||
Android development. This guide will help you to create your first Java (or Scala) application using OpenCV.
|
||||
We will use either `Eclipse <http://eclipse.org/>`_, `Apache Ant <http://ant.apache.org/>`_ or the
|
||||
@@ -15,7 +13,7 @@ We will use either `Eclipse <http://eclipse.org/>`_, `Apache Ant <http://ant.apa
|
||||
For further reading after this guide, look at the :ref:`Android_Dev_Intro` tutorials.
|
||||
|
||||
What we'll do in this guide
|
||||
***************************
|
||||
===========================
|
||||
|
||||
In this guide, we will:
|
||||
|
||||
@@ -29,12 +27,12 @@ The same process was used to create the samples in the :file:`samples/java` fold
|
||||
so consult those files if you get lost.
|
||||
|
||||
Get proper OpenCV
|
||||
*****************
|
||||
=================
|
||||
|
||||
Starting from version 2.4.4 OpenCV includes desktop Java bindings.
|
||||
|
||||
Download
|
||||
########
|
||||
--------
|
||||
|
||||
The most simple way to get it is downloading the appropriate package of **version 2.4.4 or higher** from the
|
||||
`OpenCV SourceForge repository <http://sourceforge.net/projects/opencvlibrary/files/>`_.
|
||||
@@ -50,30 +48,30 @@ In order to build OpenCV with Java bindings you need :abbr:`JDK (Java Developmen
|
||||
`Apache Ant <http://ant.apache.org/>`_ and `Python` v2.6 or higher to be installed.
|
||||
|
||||
Build
|
||||
#####
|
||||
-----
|
||||
|
||||
Let's build OpenCV:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
git clone git://github.com/Itseez/opencv.git
|
||||
cd opencv
|
||||
git checkout 2.4
|
||||
mkdir build
|
||||
cd build
|
||||
git clone git://github.com/Itseez/opencv.git
|
||||
cd opencv
|
||||
git checkout 2.4
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
Generate a Makefile or a MS Visual Studio* solution, or whatever you use for
|
||||
building executables in your system:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
cmake -DBUILD_SHARED_LIBS=OFF ..
|
||||
cmake -DBUILD_SHARED_LIBS=OFF ..
|
||||
|
||||
or
|
||||
|
||||
.. code-block:: bat
|
||||
.. code-block:: bat
|
||||
|
||||
cmake -DBUILD_SHARED_LIBS=OFF -G "Visual Studio 10" ..
|
||||
cmake -DBUILD_SHARED_LIBS=OFF -G "Visual Studio 10" ..
|
||||
|
||||
.. note:: When OpenCV is built as a set of **static** libraries (``-DBUILD_SHARED_LIBS=OFF`` option)
|
||||
the Java bindings dynamic library is all-sufficient,
|
||||
@@ -83,9 +81,9 @@ Examine the output of CMake and ensure ``java`` is one of the modules "To be bui
|
||||
If not, it's likely you're missing a dependency. You should troubleshoot by looking
|
||||
through the CMake output for any Java-related tools that aren't found and installing them.
|
||||
|
||||
.. image:: images/cmake_output.png
|
||||
:alt: CMake output
|
||||
:align: center
|
||||
.. image:: images/cmake_output.png
|
||||
:alt: CMake output
|
||||
:align: center
|
||||
|
||||
.. note:: If ``CMake`` can't find Java in your system set the ``JAVA_HOME``
|
||||
environment variable with the path to installed JDK
|
||||
@@ -99,23 +97,23 @@ through the CMake output for any Java-related tools that aren't found and instal
|
||||
|
||||
Now start the build:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
make -j8
|
||||
make -j8
|
||||
|
||||
or
|
||||
|
||||
.. code-block:: bat
|
||||
.. code-block:: bat
|
||||
|
||||
msbuild /m OpenCV.sln /t:Build /p:Configuration=Release /v:m
|
||||
msbuild /m OpenCV.sln /t:Build /p:Configuration=Release /v:m
|
||||
|
||||
Besides all this will create a ``jar`` containing the Java interface (:file:`bin/opencv-244.jar`)
|
||||
and a native dynamic library containing Java bindings and all the OpenCV stuff
|
||||
(:file:`bin/Release/opencv_java244.dll` or :file:`lib/libopencv_java244.so` respectively).
|
||||
(:file:`lib/libopencv_java244.so` or :file:`bin/Release/opencv_java244.dll` respectively).
|
||||
We'll use these files later.
|
||||
|
||||
Java sample with Ant
|
||||
********************
|
||||
====================
|
||||
|
||||
.. note::
|
||||
The described sample is provided with OpenCV library in the :file:`opencv/samples/java/ant` folder.
|
||||
@@ -124,8 +122,8 @@ Java sample with Ant
|
||||
|
||||
* In this folder create the :file:`build.xml` file with the following content using any text editor:
|
||||
|
||||
.. code-block:: xml
|
||||
:linenos:
|
||||
.. code-block:: xml
|
||||
:linenos:
|
||||
|
||||
<project name="SimpleSample" basedir="." default="rebuild-run">
|
||||
|
||||
@@ -177,18 +175,18 @@ Java sample with Ant
|
||||
|
||||
</project>
|
||||
|
||||
.. note::
|
||||
This XML file can be reused for building other Java applications.
|
||||
It describes a common folder structure in the lines 3 - 12 and common targets
|
||||
for compiling and running the application.
|
||||
.. note::
|
||||
This XML file can be reused for building other Java applications.
|
||||
It describes a common folder structure in the lines 3 - 12 and common targets
|
||||
for compiling and running the application.
|
||||
|
||||
When reusing this XML don't forget to modify the project name in the line 1,
|
||||
that is also the name of the `main` class (line 14).
|
||||
The paths to OpenCV `jar` and `jni lib` are expected as parameters
|
||||
(``"${ocvJarDir}"`` in line 5 and ``"${ocvLibDir}"`` in line 37), but
|
||||
you can hardcode these paths for your convenience.
|
||||
See `Ant documentation <http://ant.apache.org/manual/>`_ for detailed description
|
||||
of its build file format.
|
||||
When reusing this XML don't forget to modify the project name in the line 1,
|
||||
that is also the name of the `main` class (line 14).
|
||||
The paths to OpenCV `jar` and `jni lib` are expected as parameters
|
||||
(``"${ocvJarDir}"`` in line 5 and ``"${ocvLibDir}"`` in line 37), but
|
||||
you can hardcode these paths for your convenience.
|
||||
See `Ant documentation <http://ant.apache.org/manual/>`_ for detailed description
|
||||
of its build file format.
|
||||
|
||||
* Create an :file:`src` folder next to the :file:`build.xml` file and a :file:`SimpleSample.java` file in it.
|
||||
|
||||
@@ -236,99 +234,99 @@ Java sample with Ant
|
||||
:align: center
|
||||
|
||||
Java project in Eclipse
|
||||
***********************
|
||||
=======================
|
||||
|
||||
Now let's look at the possiblity of using OpenCV in Java when developing in Eclipse IDE.
|
||||
|
||||
* Create a new Eclipse workspace
|
||||
* Create a new Java project via :guilabel:`File --> New --> Java Project`
|
||||
|
||||
.. image:: images/eclipse_new_java_prj.png
|
||||
:alt: Eclipse: new Java project
|
||||
:align: center
|
||||
.. image:: images/eclipse_new_java_prj.png
|
||||
:alt: Eclipse: new Java project
|
||||
:align: center
|
||||
|
||||
Call it say "HelloCV".
|
||||
Call it say "HelloCV".
|
||||
|
||||
* Open :guilabel:`Java Build Path` tab on :guilabel:`Project Properties` dialog
|
||||
and configure additional library (OpenCV) reference (jar and native library location):
|
||||
and configure additional library (OpenCV) reference (jar and native library location):
|
||||
|
||||
.. image:: images/eclipse_user_lib.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
.. image:: images/eclipse_user_lib.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib2.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
.. image:: images/eclipse_user_lib2.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib3.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
.. image:: images/eclipse_user_lib3.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib4.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
.. image:: images/eclipse_user_lib4.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib5.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
.. image:: images/eclipse_user_lib5.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib6.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
.. image:: images/eclipse_user_lib6.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib7.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
.. image:: images/eclipse_user_lib7.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
|
||||
|
||||
.. image:: images/eclipse_user_lib8.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
.. image:: images/eclipse_user_lib8.png
|
||||
:alt: Eclipse: external JAR
|
||||
:align: center
|
||||
|
||||
` `
|
||||
|
||||
* Add a new Java class (say ``Main``) containing the application entry:
|
||||
|
||||
.. image:: images/eclipse_main_class.png
|
||||
:alt: Eclipse: Main class
|
||||
:align: center
|
||||
.. image:: images/eclipse_main_class.png
|
||||
:alt: Eclipse: Main class
|
||||
:align: center
|
||||
|
||||
* Put some simple OpenCV calls there, e.g.:
|
||||
.. code-block:: java
|
||||
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
.. code-block:: java
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
|
||||
Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
|
||||
System.out.println("m = " + m.dump());
|
||||
}
|
||||
import org.opencv.core.Core;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
|
||||
Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
|
||||
System.out.println("m = " + m.dump());
|
||||
}
|
||||
}
|
||||
|
||||
* Press :guilabel:`Run` button and find the identity matrix content in the Eclipse ``Console`` window.
|
||||
|
||||
.. image:: images/eclipse_run.png
|
||||
:alt: Eclipse: run
|
||||
:align: center
|
||||
.. image:: images/eclipse_run.png
|
||||
:alt: Eclipse: run
|
||||
:align: center
|
||||
|
||||
SBT project for Java and Scala
|
||||
******************************
|
||||
==============================
|
||||
|
||||
Now we'll create a simple Java application using SBT. This serves as a brief introduction to
|
||||
those unfamiliar with this build tool. We're using SBT because it is particularly easy and powerful.
|
||||
@@ -338,66 +336,66 @@ First, download and install `SBT <http://www.scala-sbt.org/>`_ using the instruc
|
||||
Next, navigate to a new directory where you'd like the application source to live (outside :file:`opencv` dir).
|
||||
Let's call it "JavaSample" and create a directory for it:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
cd <somewhere outside opencv>
|
||||
mkdir JavaSample
|
||||
cd <somewhere outside opencv>
|
||||
mkdir JavaSample
|
||||
|
||||
Now we will create the necessary folders and an SBT project:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
cd JavaSample
|
||||
mkdir -p src/main/java # This is where SBT expects to find Java sources
|
||||
mkdir project # This is where the build definitions live
|
||||
cd JavaSample
|
||||
mkdir -p src/main/java # This is where SBT expects to find Java sources
|
||||
mkdir project # This is where the build definitions live
|
||||
|
||||
Now open :file:`project/build.scala` in your favorite editor and paste the following.
|
||||
It defines your project:
|
||||
|
||||
.. code-block:: scala
|
||||
.. code-block:: scala
|
||||
|
||||
import sbt._
|
||||
import Keys._
|
||||
import sbt._
|
||||
import Keys._
|
||||
|
||||
object JavaSampleBuild extends Build {
|
||||
def scalaSettings = Seq(
|
||||
scalaVersion := "2.10.0",
|
||||
scalacOptions ++= Seq(
|
||||
"-optimize",
|
||||
"-unchecked",
|
||||
"-deprecation"
|
||||
)
|
||||
)
|
||||
object JavaSampleBuild extends Build {
|
||||
def scalaSettings = Seq(
|
||||
scalaVersion := "2.10.0",
|
||||
scalacOptions ++= Seq(
|
||||
"-optimize",
|
||||
"-unchecked",
|
||||
"-deprecation"
|
||||
)
|
||||
)
|
||||
|
||||
def buildSettings =
|
||||
Project.defaultSettings ++
|
||||
scalaSettings
|
||||
def buildSettings =
|
||||
Project.defaultSettings ++
|
||||
scalaSettings
|
||||
|
||||
lazy val root = {
|
||||
val settings = buildSettings ++ Seq(name := "JavaSample")
|
||||
Project(id = "JavaSample", base = file("."), settings = settings)
|
||||
}
|
||||
}
|
||||
lazy val root = {
|
||||
val settings = buildSettings ++ Seq(name := "JavaSample")
|
||||
Project(id = "JavaSample", base = file("."), settings = settings)
|
||||
}
|
||||
}
|
||||
|
||||
Now edit :file:`project/plugins.sbt` and paste the following.
|
||||
This will enable auto-generation of an Eclipse project:
|
||||
|
||||
.. code-block:: scala
|
||||
.. code-block:: scala
|
||||
|
||||
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
|
||||
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
|
||||
|
||||
Now run ``sbt`` from the :file:`JavaSample` root and from within SBT run ``eclipse`` to generate an eclipse project:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
sbt # Starts the sbt console
|
||||
> eclipse # Running "eclipse" from within the sbt console
|
||||
sbt # Starts the sbt console
|
||||
> eclipse # Running "eclipse" from within the sbt console
|
||||
|
||||
You should see something like this:
|
||||
|
||||
.. image:: images/sbt_eclipse.png
|
||||
:alt: SBT output
|
||||
:align: center
|
||||
.. image:: images/sbt_eclipse.png
|
||||
:alt: SBT output
|
||||
:align: center
|
||||
|
||||
You can now import the SBT project to Eclipse using :guilabel:`Import ... -> Existing projects into workspace`.
|
||||
Whether you actually do this is optional for the guide;
|
||||
@@ -406,28 +404,28 @@ we'll be using SBT to build the project, so if you choose to use Eclipse it will
|
||||
To test that everything is working, create a simple "Hello OpenCV" application.
|
||||
Do this by creating a file :file:`src/main/java/HelloOpenCV.java` with the following contents:
|
||||
|
||||
.. code-block:: java
|
||||
.. code-block:: java
|
||||
|
||||
public class HelloOpenCV {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, OpenCV");
|
||||
}
|
||||
}
|
||||
public class HelloOpenCV {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello, OpenCV");
|
||||
}
|
||||
}
|
||||
|
||||
Now execute ``run`` from the sbt console, or more concisely, run ``sbt run`` from the command line:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
sbt run
|
||||
sbt run
|
||||
|
||||
You should see something like this:
|
||||
|
||||
.. image:: images/sbt_run.png
|
||||
:alt: SBT run
|
||||
:align: center
|
||||
.. image:: images/sbt_run.png
|
||||
:alt: SBT run
|
||||
:align: center
|
||||
|
||||
Running SBT samples
|
||||
###################
|
||||
-------------------
|
||||
|
||||
Now we'll create a simple face detection application using OpenCV.
|
||||
|
||||
@@ -435,17 +433,17 @@ First, create a :file:`lib/` folder and copy the OpenCV jar into it.
|
||||
By default, SBT adds jars in the lib folder to the Java library search path.
|
||||
You can optionally rerun ``sbt eclipse`` to update your Eclipse project.
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
mkdir lib
|
||||
cp <opencv_dir>/build/bin/opencv_<version>.jar lib/
|
||||
sbt eclipse
|
||||
mkdir lib
|
||||
cp <opencv_dir>/build/bin/opencv_<version>.jar lib/
|
||||
sbt eclipse
|
||||
|
||||
Next, create the directory :file:`src/main/resources` and download this Lena image into it:
|
||||
|
||||
.. image:: images/lena.png
|
||||
:alt: Lena
|
||||
:align: center
|
||||
.. image:: images/lena.png
|
||||
:alt: Lena
|
||||
:align: center
|
||||
|
||||
Make sure it's called :file:`"lena.png"`.
|
||||
Items in the resources directory are available to the Java application at runtime.
|
||||
@@ -453,9 +451,9 @@ Items in the resources directory are available to the Java application at runtim
|
||||
Next, copy :file:`lbpcascade_frontalface.xml` from :file:`opencv/data/lbpcascades/` into the :file:`resources`
|
||||
directory:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
cp <opencv_dir>/data/lbpcascades/lbpcascade_frontalface.xml src/main/resources/
|
||||
cp <opencv_dir>/data/lbpcascades/lbpcascade_frontalface.xml src/main/resources/
|
||||
|
||||
Now modify src/main/java/HelloOpenCV.java so it contains the following Java code:
|
||||
|
||||
@@ -519,21 +517,21 @@ You will also get errors if you try to load OpenCV when it has already been load
|
||||
|
||||
Now run the face detection app using ``sbt run``:
|
||||
|
||||
.. code-block:: bash
|
||||
.. code-block:: bash
|
||||
|
||||
sbt run
|
||||
sbt run
|
||||
|
||||
You should see something like this:
|
||||
|
||||
.. image:: images/sbt_run_face.png
|
||||
:alt: SBT run
|
||||
:align: center
|
||||
.. image:: images/sbt_run_face.png
|
||||
:alt: SBT run
|
||||
:align: center
|
||||
|
||||
It should also write the following image to :file:`faceDetection.png`:
|
||||
|
||||
.. image:: images/faceDetection.png
|
||||
:alt: Detected face
|
||||
:align: center
|
||||
.. image:: images/faceDetection.png
|
||||
:alt: Detected face
|
||||
:align: center
|
||||
|
||||
You're done!
|
||||
Now you have a sample Java application working with OpenCV, so you can start the work on your own.
|
||||
|
||||
@@ -201,8 +201,6 @@ Assuming that the image to use as the argument would be located in <DisplayImage
|
||||
V2: Using CMake+OpenCV with Eclipse (plugin CDT)
|
||||
==================================================
|
||||
|
||||
(See the `getting started <http://opencv.willowgarage.com/wiki/Getting_started>` section of the OpenCV Wiki)
|
||||
|
||||
Say you have or create a new file, *helloworld.cpp* in a directory called *foo*:
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
|
After Width: | Height: | Size: 18 KiB |
@@ -103,6 +103,21 @@ world of the OpenCV.
|
||||
:height: 90pt
|
||||
:width: 90pt
|
||||
|
||||
=========== ======================================================
|
||||
|WinVSVis| **Title:** :ref:`Windows_Visual_Studio_Image_Watch`
|
||||
|
||||
*Compatibility:* >= OpenCV 2.4
|
||||
|
||||
*Author:* Wolf Kienzle
|
||||
|
||||
You will learn how to visualize OpenCV matrices and images within Visual Studio 2012.
|
||||
|
||||
=========== ======================================================
|
||||
|
||||
.. |WinVSVis| image:: images/visual_studio_image_watch.png
|
||||
:height: 90pt
|
||||
:width: 90pt
|
||||
|
||||
* **Desktop Java**
|
||||
|
||||
.. tabularcolumns:: m{100pt} m{300pt}
|
||||
@@ -278,6 +293,7 @@ world of the OpenCV.
|
||||
../linux_eclipse/linux_eclipse
|
||||
../windows_install/windows_install
|
||||
../windows_visual_studio_Opencv/windows_visual_studio_Opencv
|
||||
../windows_visual_studio_image_watch/windows_visual_studio_image_watch
|
||||
../desktop_java/java_dev_intro
|
||||
../android_binary_package/android_dev_intro
|
||||
../android_binary_package/O4A_SDK
|
||||
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
@@ -0,0 +1,144 @@
|
||||
.. _Windows_Visual_Studio_Image_Watch:
|
||||
|
||||
Image Watch: viewing in-memory images in the Visual Studio debugger
|
||||
*******************************************************************
|
||||
|
||||
Image Watch is a plug-in for Microsoft Visual Studio that lets you to visualize in-memory images (*cv::Mat* or *IplImage\_* objects, for example) while debugging an application. This can be helpful for tracking down bugs, or for simply understanding what a given piece of code is doing.
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
This tutorial assumes that you have the following available:
|
||||
|
||||
#. Visual Studio 2012 Professional (or better) with Update 1 installed. Update 1 can be downloaded `here <http://www.microsoft.com/en-us/download/details.aspx?id=35774>`_.
|
||||
|
||||
#. An OpenCV installation on your Windows machine (Tutorial: :ref:`Windows_Installation`).
|
||||
|
||||
#. Ability to create and build OpenCV projects in Visual Studio (Tutorial: :ref:`Windows_Visual_Studio_How_To`).
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
`Download <http://go.microsoft.com/fwlink/?LinkId=285460>`_ the Image Watch installer. The installer comes in a single file with extension .vsix (*Visual Studio Extension*). To launch it, simply double-click on the .vsix file in Windows Explorer. When the installer has finished, make sure to restart Visual Studio to complete the installation.
|
||||
|
||||
Example
|
||||
=======
|
||||
|
||||
Image Watch works with any existing project that uses OpenCV image objects (for example, *cv::Mat*). In this example, we use a minimal test program that loads an image from a file and runs an edge detector. To build the program, create a console application project in Visual Studio, name it "image-watch-demo", and insert the source code below.
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
// Test application for the Visual Studio Image Watch Debugger extension
|
||||
|
||||
#include <iostream> // std::cout
|
||||
#include <opencv2/core/core.hpp> // cv::Mat
|
||||
#include <opencv2/highgui/highgui.hpp> // cv::imread()
|
||||
#include <opencv2/imgproc/imgproc.hpp> // cv::Canny()
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
void help()
|
||||
{
|
||||
cout
|
||||
<< "----------------------------------------------------" << endl
|
||||
<< "This is a test program for the Image Watch Debugger " << endl
|
||||
<< "plug-in for Visual Studio. The program loads an " << endl
|
||||
<< "image from a file and runs the Canny edge detector. " << endl
|
||||
<< "No output is displayed or written to disk."
|
||||
<< endl
|
||||
<< "Usage:" << endl
|
||||
<< "image-watch-demo inputimage" << endl
|
||||
<< "----------------------------------------------------" << endl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
help();
|
||||
|
||||
if (argc != 2)
|
||||
{
|
||||
cout << "Wrong number of parameters" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
cout << "Loading input image: " << argv[1] << endl;
|
||||
Mat input;
|
||||
input = imread(argv[1], CV_LOAD_IMAGE_COLOR);
|
||||
|
||||
cout << "Detecting edges in input image" << endl;
|
||||
Mat edges;
|
||||
Canny(input, edges, 10, 100);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Make sure your active solution configuration (:menuselection:`Build --> Configuration Manager`) is set to a debug build (usually called "Debug"). This should disable compiler optimizations so that viewing variables in the debugger can work reliably.
|
||||
|
||||
Build your solution (:menuselection:`Build --> Build Solution`, or press *F7*).
|
||||
|
||||
Now set a breakpoint on the source line that says
|
||||
|
||||
.. code-block:: c++
|
||||
|
||||
Mat edges;
|
||||
|
||||
To set the breakpoint, right-click on the source line and select :menuselection:`Breakpoints --> Insert Breakpoint` from the context menu.
|
||||
|
||||
Launch the program in the debugger (:menuselection:`Debug --> Start Debugging`, or hit *F5*). When the breakpoint is hit, the program is paused and Visual Studio displays a yellow instruction pointer at the breakpoint:
|
||||
|
||||
.. image:: images/breakpoint.png
|
||||
|
||||
Now you can inspect the state of you program. For example, you can bring up the *Locals* window (:menuselection:`Debug --> Windows --> Locals`), which will show the names and values of the variables in the current scope:
|
||||
|
||||
.. image:: images/vs_locals.png
|
||||
|
||||
Note that the built-in *Locals* window will display text only. This is where the Image Watch plug-in comes in. Image Watch is like another *Locals* window, but with an image viewer built into it. To bring up Image Watch, select :menuselection:`View --> Other Windows --> Image Watch`. Like Visual Studio's *Locals* window, Image Watch can dock to the Visual Studio IDE. Also, Visual Studio will remember whether you had Image Watch open, and where it was located between debugging sessions. This means you only have to do this once--the next time you start debugging, Image Watch will be back where you left it. Here's what the docked Image Watch window looks like at our breakpoint:
|
||||
|
||||
.. image:: images/toolwindow.jpg
|
||||
:height: 320pt
|
||||
|
||||
The radio button at the top left (*Locals/Watch*) selects what is shown in the *Image List* below: *Locals* lists all OpenCV image objects in the current scope (this list is automatically populated). *Watch* shows image expressions that have been pinned for continuous inspection (not described here, see `Image Watch documentation <http://go.microsoft.com/fwlink/?LinkId=285461>`_ for details). The image list shows basic information such as width, height, number of channels, and, if available, a thumbnail. In our example, the image list contains our two local image variables, *input* and *edges*.
|
||||
|
||||
If an image has a thumbnail, left-clicking on that image will select it for detailed viewing in the *Image Viewer* on the right. The viewer lets you pan (drag mouse) and zoom (mouse wheel). It also displays the pixel coordinate and value at the current mouse position.
|
||||
|
||||
.. image:: images/viewer.jpg
|
||||
:height: 160pt
|
||||
|
||||
Note that the second image in the list, *edges*, is shown as "invalid". This indicates that some data members of this image object have corrupt or invalid values (for example, a negative image width). This is expected at this point in the program, since the C++ constructor for *edges* has not run yet, and so its members have undefined values (in debug mode they are usually filled with "0xCD" bytes).
|
||||
|
||||
From here you can single-step through your code (:menuselection:`Debug->Step Over`, or press *F10*) and watch the pixels change: if you step once, over the *Mat edges;* statement, the *edges* image will change from "invalid" to "empty", which means that it is now in a valid state (default constructed), even though it has not been initialized yet (using *cv::Mat::create()*, for example). If you make one more step over the *cv::Canny()* call, you will see a thumbnail of the edge image appear in the image list.
|
||||
|
||||
Now assume you want to do a visual sanity check of the *cv::Canny()* implementation. Bring the *edges* image into the viewer by selecting it in the *Image List* and zoom into a region with a clearly defined edge:
|
||||
|
||||
.. image:: images/edges_zoom.png
|
||||
:height: 160pt
|
||||
|
||||
Right-click on the *Image Viewer* to bring up the view context menu and enable :menuselection:`Link Views` (a check box next to the menu item indicates whether the option is enabled).
|
||||
|
||||
.. image:: images/viewer_context_menu.png
|
||||
:height: 120pt
|
||||
|
||||
The :menuselection:`Link Views` feature keeps the view region fixed when flipping between images of the same size. To see how this works, select the input image from the image list--you should now see the corresponding zoomed-in region in the input image:
|
||||
|
||||
.. image:: images/input_zoom.png
|
||||
:height: 160pt
|
||||
|
||||
You may also switch back and forth between viewing input and edges with your up/down cursor keys. That way you can easily verify that the detected edges line up nicely with the data in the input image.
|
||||
|
||||
More ...
|
||||
====================
|
||||
|
||||
Image watch has a number of more advanced features, such as
|
||||
|
||||
#. pinning images to a *Watch* list for inspection across scopes or between debugging sessions
|
||||
|
||||
#. clamping, thresholding, or diff'ing images directly inside the Watch window
|
||||
|
||||
#. comparing an in-memory image against a reference image from a file
|
||||
|
||||
Please refer to the online `Image Watch Documentation <http://go.microsoft.com/fwlink/?LinkId=285461>`_ for details--you also can get to the documentation page by clicking on the *Help* link in the Image Watch window:
|
||||
|
||||
.. image:: images/help_button.jpg
|
||||
:height: 80pt
|
||||
@@ -103,10 +103,10 @@ def put_framework_together(srcroot, dstroot):
|
||||
# TODO ...
|
||||
|
||||
# make symbolic links
|
||||
os.symlink(dstdir + "/Headers", "Headers")
|
||||
os.symlink(dstdir + "/Resources", "Resources")
|
||||
os.symlink(dstdir + "/opencv2", "opencv2")
|
||||
os.symlink("A", "Versions/Current")
|
||||
os.symlink("Versions/Current/Headers", "Headers")
|
||||
os.symlink("Versions/Current/Resources", "Resources")
|
||||
os.symlink("Versions/Current/opencv2", "opencv2")
|
||||
|
||||
|
||||
def build_framework(srcroot, dstroot):
|
||||
|
||||
@@ -207,9 +207,9 @@ prefilterXSobel( const Mat& src, Mat& dst, int ftzero )
|
||||
d1 = _mm_sub_epi16(d1, c1);
|
||||
|
||||
__m128i c2 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)(srow2 + x - 1)), z);
|
||||
__m128i c3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)(srow2 + x - 1)), z);
|
||||
__m128i c3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)(srow3 + x - 1)), z);
|
||||
__m128i d2 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)(srow2 + x + 1)), z);
|
||||
__m128i d3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)(srow2 + x + 1)), z);
|
||||
__m128i d3 = _mm_unpacklo_epi8(_mm_loadl_epi64((__m128i*)(srow3 + x + 1)), z);
|
||||
|
||||
d2 = _mm_sub_epi16(d2, c2);
|
||||
d3 = _mm_sub_epi16(d3, c3);
|
||||
|
||||
@@ -236,7 +236,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
TEST(Calib3d_SolvePnPRansac, accuracy) { CV_solvePnPRansac_Test test; test.safe_run(); }
|
||||
TEST(DISABLED_Calib3d_SolvePnPRansac, accuracy) { CV_solvePnPRansac_Test test; test.safe_run(); }
|
||||
TEST(Calib3d_SolvePnP, accuracy) { CV_solvePnP_Test test; test.safe_run(); }
|
||||
|
||||
|
||||
|
||||
@@ -459,14 +459,29 @@ void CV_StereoMatchingTest::run(int)
|
||||
continue;
|
||||
}
|
||||
int dispScaleFactor = datasetsParams[datasetName].dispScaleFactor;
|
||||
Mat tmp; trueLeftDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor ); trueLeftDisp = tmp; tmp.release();
|
||||
Mat tmp;
|
||||
|
||||
trueLeftDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor );
|
||||
trueLeftDisp = tmp;
|
||||
tmp.release();
|
||||
|
||||
if( !trueRightDisp.empty() )
|
||||
trueRightDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor ); trueRightDisp = tmp; tmp.release();
|
||||
{
|
||||
trueRightDisp.convertTo( tmp, CV_32FC1, 1.f/dispScaleFactor );
|
||||
trueRightDisp = tmp;
|
||||
tmp.release();
|
||||
}
|
||||
|
||||
Mat leftDisp, rightDisp;
|
||||
int ignBorder = max(runStereoMatchingAlgorithm(leftImg, rightImg, leftDisp, rightDisp, ci), EVAL_IGNORE_BORDER);
|
||||
leftDisp.convertTo( tmp, CV_32FC1 ); leftDisp = tmp; tmp.release();
|
||||
rightDisp.convertTo( tmp, CV_32FC1 ); rightDisp = tmp; tmp.release();
|
||||
|
||||
leftDisp.convertTo( tmp, CV_32FC1 );
|
||||
leftDisp = tmp;
|
||||
tmp.release();
|
||||
|
||||
rightDisp.convertTo( tmp, CV_32FC1 );
|
||||
rightDisp = tmp;
|
||||
tmp.release();
|
||||
|
||||
int tempCode = processStereoMatchingResults( resFS, ci, isWrite,
|
||||
leftImg, rightImg, trueLeftDisp, trueRightDisp, leftDisp, rightDisp, QualityEvalParams(ignBorder));
|
||||
@@ -530,7 +545,8 @@ int CV_StereoMatchingTest::processStereoMatchingResults( FileStorage& fs, int ca
|
||||
// rightDisp is not used in current test virsion
|
||||
int code = cvtest::TS::OK;
|
||||
assert( fs.isOpened() );
|
||||
assert( trueLeftDisp.type() == CV_32FC1 && trueRightDisp.type() == CV_32FC1 );
|
||||
assert( trueLeftDisp.type() == CV_32FC1 );
|
||||
assert( trueRightDisp.empty() || trueRightDisp.type() == CV_32FC1 );
|
||||
assert( leftDisp.type() == CV_32FC1 && rightDisp.type() == CV_32FC1 );
|
||||
|
||||
// get masks for unknown ground truth disparity values
|
||||
|
||||
@@ -7,7 +7,7 @@ Face Recognition with OpenCV
|
||||
Introduction
|
||||
============
|
||||
|
||||
`OpenCV (Open Source Computer Vision) <http://opencv.willowgarage.com>`_ is a popular computer vision library started by `Intel <http://www.intel.com>`_ in 1999. The cross-platform library sets its focus on real-time image processing and includes patent-free implementations of the latest computer vision algorithms. In 2008 `Willow Garage <http://www.willowgarage.com>`_ took over support and OpenCV 2.3.1 now comes with a programming interface to C, C++, `Python <http://www.python.org>`_ and `Android <http://www.android.com>`_. OpenCV is released under a BSD license so it is used in academic projects and commercial products alike.
|
||||
`OpenCV (Open Source Computer Vision) <http://opencv.org>`_ is a popular computer vision library started by `Intel <http://www.intel.com>`_ in 1999. The cross-platform library sets its focus on real-time image processing and includes patent-free implementations of the latest computer vision algorithms. In 2008 `Willow Garage <http://www.willowgarage.com>`_ took over support and OpenCV 2.3.1 now comes with a programming interface to C, C++, `Python <http://www.python.org>`_ and `Android <http://www.android.com>`_. OpenCV is released under a BSD license so it is used in academic projects and commercial products alike.
|
||||
|
||||
OpenCV 2.4 now comes with the very new :ocv:class:`FaceRecognizer` class for face recognition, so you can start experimenting with face recognition right away. This document is the guide I've wished for, when I was working myself into face recognition. It shows you how to perform face recognition with :ocv:class:`FaceRecognizer` in OpenCV (with full source code listings) and gives you an introduction into the algorithms behind. I'll also show how to create the visualizations you can find in many publications, because a lot of people asked for.
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ project(facerec_cpp_samples)
|
||||
#SET(OpenCV_DIR /path/to/your/opencv/installation)
|
||||
|
||||
# packages
|
||||
find_package(OpenCV REQUIRED) # http://opencv.willowgarage.com
|
||||
find_package(OpenCV REQUIRED) # http://opencv.org
|
||||
|
||||
# probably you should loop through the sample files here
|
||||
add_executable(facerec_demo facerec_demo.cpp)
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace cv
|
||||
|
||||
typedef bool (*BundleAdjustCallback)(int iteration, double norm_error, void* user_data);
|
||||
|
||||
class LevMarqSparse {
|
||||
class CV_EXPORTS LevMarqSparse {
|
||||
public:
|
||||
LevMarqSparse();
|
||||
LevMarqSparse(int npoints, // number of points
|
||||
|
||||
@@ -1105,7 +1105,7 @@ void LevMarqSparse::bundleAdjust( vector<Point3d>& points, //positions of points
|
||||
Mat rot_vec = Mat(levmar.P).rowRange(i*num_cam_param, i*num_cam_param+3);
|
||||
Rodrigues( rot_vec, R[i] );
|
||||
//translation
|
||||
T[i] = Mat(levmar.P).rowRange(i*num_cam_param + 3, i*num_cam_param+6);
|
||||
Mat(levmar.P).rowRange(i*num_cam_param + 3, i*num_cam_param+6).copyTo(T[i]);
|
||||
|
||||
//intrinsic camera matrix
|
||||
double* intr_data = (double*)cameraMatrix[i].data;
|
||||
|
||||
@@ -380,6 +380,7 @@ void CvFuzzyMeanShiftTracker::SearchWindow::initDepthValues(IplImage *maskImage,
|
||||
{
|
||||
if (*depthData)
|
||||
{
|
||||
d = *depthData;
|
||||
m1 += d;
|
||||
if (d < mind)
|
||||
mind = d;
|
||||
|
||||
@@ -85,10 +85,10 @@ namespace
|
||||
};
|
||||
size_t colors_mum = sizeof(colors)/sizeof(colors[0]);
|
||||
|
||||
#if (defined __cplusplus && __cplusplus > 199711L) || defined _STLPORT_MAJOR
|
||||
#else
|
||||
template<class FwIt, class T> void iota(FwIt first, FwIt last, T value) { while(first != last) *first++ = value++; }
|
||||
#endif
|
||||
template<class FwIt, class T> inline void _iota(FwIt first, FwIt last, T value)
|
||||
{
|
||||
while(first != last) *first++ = value++;
|
||||
}
|
||||
|
||||
void computeNormals( const Octree& Octree, const vector<Point3f>& centers, vector<Point3f>& normals,
|
||||
vector<uchar>& mask, float normalRadius, int minNeighbors = 20)
|
||||
@@ -799,14 +799,14 @@ void cv::SpinImageModel::selectRandomSubset(float ratio)
|
||||
else if (setSize == vtxSize)
|
||||
{
|
||||
subset.resize(vtxSize);
|
||||
iota(subset.begin(), subset.end(), 0);
|
||||
_iota(subset.begin(), subset.end(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
RNG& rnd = theRNG();
|
||||
|
||||
vector<size_t> left(vtxSize);
|
||||
iota(left.begin(), left.end(), (size_t)0);
|
||||
_iota(left.begin(), left.end(), (size_t)0);
|
||||
|
||||
subset.resize(setSize);
|
||||
for(size_t i = 0; i < setSize; ++i)
|
||||
@@ -879,7 +879,7 @@ void cv::SpinImageModel::compute()
|
||||
{
|
||||
mesh.computeNormals(normalRadius, minNeighbors);
|
||||
subset.resize(mesh.vtx.size());
|
||||
iota(subset.begin(), subset.end(), 0);
|
||||
_iota(subset.begin(), subset.end(), 0);
|
||||
}
|
||||
else
|
||||
mesh.computeNormals(subset, normalRadius, minNeighbors);
|
||||
|
||||
@@ -4,7 +4,7 @@ Introduction
|
||||
|
||||
.. highlight:: cpp
|
||||
|
||||
OpenCV (Open Source Computer Vision Library: http://opencv.willowgarage.com/wiki/) is an open-source BSD-licensed library that includes several hundreds of computer vision algorithms. The document describes the so-called OpenCV 2.x API, which is essentially a C++ API, as opposite to the C-based OpenCV 1.x API. The latter is described in opencv1x.pdf.
|
||||
OpenCV (Open Source Computer Vision Library: http://opencv.org) is an open-source BSD-licensed library that includes several hundreds of computer vision algorithms. The document describes the so-called OpenCV 2.x API, which is essentially a C++ API, as opposite to the C-based OpenCV 1.x API. The latter is described in opencv1x.pdf.
|
||||
|
||||
OpenCV has a modular structure, which means that the package includes several shared or static libraries. The following modules are available:
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ Calculates the per-element sum of two arrays or an array and a scalar.
|
||||
|
||||
:param dst: output array that has the same size and number of channels as the input array(s); the depth is defined by ``dtype`` or ``src1``/``src2``.
|
||||
|
||||
:param mask: optional operation mask – 8-bit single channel array, that specifies elements of the output array to be changed.
|
||||
:param mask: optional operation mask - 8-bit single channel array, that specifies elements of the output array to be changed.
|
||||
|
||||
:param dtype: optional depth of the output array (see the discussion below).
|
||||
|
||||
@@ -868,7 +868,7 @@ Performs a forward or inverse Discrete Fourier transform of a 1D or 2D floating-
|
||||
* **DFT_SCALE** scales the result: divide it by the number of array elements. Normally, it is combined with ``DFT_INVERSE``.
|
||||
* **DFT_ROWS** performs a forward or inverse transform of every individual row of the input matrix; this flag enables you to transform multiple vectors simultaneously and can be used to decrease the overhead (which is sometimes several times larger than the processing itself) to perform 3D and higher-dimensional transformations and so forth.
|
||||
|
||||
* **DFT_COMPLEX_OUTPUT** performs a forward transformation of 1D or 2D real array; the result, though being a complex array, has complex-conjugate symmetry (*CCS*, see the function description below for details), and such an array can be packed into a real array of the same size as input, which is the fastest option and which is what the function does by default; however, you may wish to get a full complex array (for simpler spectrum analysis, and so on) – pass the flag to enable the function to produce a full-size complex output array.
|
||||
* **DFT_COMPLEX_OUTPUT** performs a forward transformation of 1D or 2D real array; the result, though being a complex array, has complex-conjugate symmetry (*CCS*, see the function description below for details), and such an array can be packed into a real array of the same size as input, which is the fastest option and which is what the function does by default; however, you may wish to get a full complex array (for simpler spectrum analysis, and so on) - pass the flag to enable the function to produce a full-size complex output array.
|
||||
|
||||
* **DFT_REAL_OUTPUT** performs an inverse transformation of a 1D or 2D complex array; the result is normally a complex array of the same size, however, if the input array has conjugate-complex symmetry (for example, it is a result of forward transformation with ``DFT_COMPLEX_OUTPUT`` flag), the output is a real array; while the function itself does not check whether the input is symmetrical or not, you can pass the flag and then the function will assume the symmetry and produce the real output array (note that when the input is packed into a real array and inverse transformation is executed, the function treats the input as a packed complex-conjugate symmetrical array, and the output will also be a real array).
|
||||
|
||||
|
||||
@@ -3767,6 +3767,7 @@ public:
|
||||
SparseMatConstIterator_();
|
||||
//! the full constructor setting the iterator to the first sparse matrix element
|
||||
SparseMatConstIterator_(const SparseMat_<_Tp>* _m);
|
||||
SparseMatConstIterator_(const SparseMat* _m);
|
||||
//! the copy constructor
|
||||
SparseMatConstIterator_(const SparseMatConstIterator_& it);
|
||||
|
||||
@@ -3796,6 +3797,7 @@ public:
|
||||
SparseMatIterator_();
|
||||
//! the full constructor setting the iterator to the first sparse matrix element
|
||||
SparseMatIterator_(SparseMat_<_Tp>* _m);
|
||||
SparseMatIterator_(SparseMat* _m);
|
||||
//! the copy constructor
|
||||
SparseMatIterator_(const SparseMatIterator_& it);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other GpuMaterials provided with the distribution.
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other GpuMaterials provided with the distribution.
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other GpuMaterials provided with the distribution.
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
@@ -431,7 +431,7 @@ template<typename _Tp> inline _Tp* Mat::ptr(int y)
|
||||
|
||||
template<typename _Tp> inline const _Tp* Mat::ptr(int y) const
|
||||
{
|
||||
CV_DbgAssert( y == 0 || (data && dims >= 1 && data && (unsigned)y < (unsigned)size.p[0]) );
|
||||
CV_DbgAssert( y == 0 || (data && dims >= 1 && (unsigned)y < (unsigned)size.p[0]) );
|
||||
return (const _Tp*)(data + step.p[0]*y);
|
||||
}
|
||||
|
||||
@@ -2530,6 +2530,13 @@ SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMat_<_Tp>* _m)
|
||||
: SparseMatConstIterator(_m)
|
||||
{}
|
||||
|
||||
template<typename _Tp> inline
|
||||
SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMat* _m)
|
||||
: SparseMatConstIterator(_m)
|
||||
{
|
||||
CV_Assert( _m->type() == DataType<_Tp>::type );
|
||||
}
|
||||
|
||||
template<typename _Tp> inline
|
||||
SparseMatConstIterator_<_Tp>::SparseMatConstIterator_(const SparseMatConstIterator_<_Tp>& it)
|
||||
: SparseMatConstIterator(it)
|
||||
@@ -2569,6 +2576,11 @@ SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat_<_Tp>* _m)
|
||||
: SparseMatConstIterator_<_Tp>(_m)
|
||||
{}
|
||||
|
||||
template<typename _Tp> inline
|
||||
SparseMatIterator_<_Tp>::SparseMatIterator_(SparseMat* _m)
|
||||
: SparseMatConstIterator_<_Tp>(_m)
|
||||
{}
|
||||
|
||||
template<typename _Tp> inline
|
||||
SparseMatIterator_<_Tp>::SparseMatIterator_(const SparseMatIterator_<_Tp>& it)
|
||||
: SparseMatConstIterator_<_Tp>(it)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other GpuMaterials provided with the distribution.
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other GpuMaterials provided with the distribution.
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
|
||||
@@ -2917,6 +2917,9 @@ CV_EXPORTS FileStorage& operator << (FileStorage& fs, const string& str);
|
||||
static inline FileStorage& operator << (FileStorage& fs, const char* str)
|
||||
{ return (fs << string(str)); }
|
||||
|
||||
static inline FileStorage& operator << (FileStorage& fs, char* value)
|
||||
{ return (fs << string(value)); }
|
||||
|
||||
inline FileNode::FileNode() : fs(0), node(0) {}
|
||||
inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node)
|
||||
: fs(_fs), node(_node) {}
|
||||
|
||||
@@ -315,6 +315,8 @@ CV_INLINE int cvRound( double value )
|
||||
fistp t;
|
||||
}
|
||||
return t;
|
||||
#elif defined _MSC_VER && defined _M_ARM && defined HAVE_TEGRA_OPTIMIZATION
|
||||
TEGRA_ROUND(value);
|
||||
#elif defined HAVE_LRINT || defined CV_ICC || defined __GNUC__
|
||||
# ifdef HAVE_TEGRA_OPTIMIZATION
|
||||
TEGRA_ROUND(value);
|
||||
@@ -322,8 +324,12 @@ CV_INLINE int cvRound( double value )
|
||||
return (int)lrint(value);
|
||||
# endif
|
||||
#else
|
||||
// while this is not IEEE754-compliant rounding, it's usually a good enough approximation
|
||||
return (int)(value + (value >= 0 ? 0.5 : -0.5));
|
||||
double intpart, fractpart;
|
||||
fractpart = modf(value, &intpart);
|
||||
if ((fabs(fractpart) != 0.5) || ((((int)intpart) % 2) != 0))
|
||||
return (int)(value + (value >= 0 ? 0.5 : -0.5));
|
||||
else
|
||||
return (int)intpart;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#define CV_VERSION_EPOCH 2
|
||||
#define CV_VERSION_MAJOR 4
|
||||
#define CV_VERSION_MINOR 4
|
||||
#define CV_VERSION_MINOR 5
|
||||
#define CV_VERSION_REVISION 0
|
||||
|
||||
#define CVAUX_STR_EXP(__A) #__A
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
|
||||
#include "opencv2/gpu/device/saturate_cast.hpp"
|
||||
#include "opencv2/gpu/device/transform.hpp"
|
||||
#include "opencv2/gpu/device/functional.hpp"
|
||||
|
||||
@@ -1,3 +1,45 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "cvconfig.h"
|
||||
|
||||
@@ -1,3 +1,45 @@
|
||||
/*M///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
//
|
||||
// By downloading, copying, installing or using the software you agree to this license.
|
||||
// If you do not agree to this license, do not download, install,
|
||||
// copy or use the software.
|
||||
//
|
||||
//
|
||||
// License Agreement
|
||||
// For Open Source Computer Vision Library
|
||||
//
|
||||
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistribution's of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistribution's in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// * The name of the copyright holders may not be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
// (including, but not limited to, procurement of substitute goods or services;
|
||||
// loss of use, data, or profits; or business interruption) however caused
|
||||
// and on any theory of liability, whether in contract, strict liability,
|
||||
// or tort (including negligence or otherwise) arising in any way out of
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef OPENGL_NOLOAD_STYLE_HPP
|
||||
#define OPENGL_NOLOAD_STYLE_HPP
|
||||
|
||||
|
||||
@@ -531,12 +531,12 @@ template<> inline int VBLAS<double>::givensx(double* a, double* b, int n, double
|
||||
#endif
|
||||
|
||||
template<typename _Tp> void
|
||||
JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int n, int n1, double minval)
|
||||
JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep,
|
||||
int m, int n, int n1, double minval, _Tp eps)
|
||||
{
|
||||
VBLAS<_Tp> vblas;
|
||||
AutoBuffer<double> Wbuf(n);
|
||||
double* W = Wbuf;
|
||||
_Tp eps = DBL_EPSILON*10;
|
||||
int i, j, k, iter, max_iter = std::max(m, 30);
|
||||
_Tp c, s;
|
||||
double sd;
|
||||
@@ -577,10 +577,10 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int
|
||||
continue;
|
||||
|
||||
p *= 2;
|
||||
double beta = a - b, gamma = hypot((double)p, beta), delta;
|
||||
double beta = a - b, gamma = hypot((double)p, beta);
|
||||
if( beta < 0 )
|
||||
{
|
||||
delta = (gamma - beta)*0.5;
|
||||
double delta = (gamma - beta)*0.5;
|
||||
s = (_Tp)std::sqrt(delta/gamma);
|
||||
c = (_Tp)(p/(gamma*s*2));
|
||||
}
|
||||
@@ -588,36 +588,18 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int
|
||||
{
|
||||
c = (_Tp)std::sqrt((gamma + beta)/(gamma*2));
|
||||
s = (_Tp)(p/(gamma*c*2));
|
||||
delta = p*p*0.5/(gamma + beta);
|
||||
}
|
||||
|
||||
W[i] += delta;
|
||||
W[j] -= delta;
|
||||
|
||||
if( iter % 2 != 0 && W[i] > 0 && W[j] > 0 )
|
||||
a = b = 0;
|
||||
for( k = 0; k < m; k++ )
|
||||
{
|
||||
k = vblas.givens(Ai, Aj, m, c, s);
|
||||
_Tp t0 = c*Ai[k] + s*Aj[k];
|
||||
_Tp t1 = -s*Ai[k] + c*Aj[k];
|
||||
Ai[k] = t0; Aj[k] = t1;
|
||||
|
||||
for( ; k < m; k++ )
|
||||
{
|
||||
_Tp t0 = c*Ai[k] + s*Aj[k];
|
||||
_Tp t1 = -s*Ai[k] + c*Aj[k];
|
||||
Ai[k] = t0; Aj[k] = t1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
a = b = 0;
|
||||
for( k = 0; k < m; k++ )
|
||||
{
|
||||
_Tp t0 = c*Ai[k] + s*Aj[k];
|
||||
_Tp t1 = -s*Ai[k] + c*Aj[k];
|
||||
Ai[k] = t0; Aj[k] = t1;
|
||||
|
||||
a += (double)t0*t0; b += (double)t1*t1;
|
||||
}
|
||||
W[i] = a; W[j] = b;
|
||||
a += (double)t0*t0; b += (double)t1*t1;
|
||||
}
|
||||
W[i] = a; W[j] = b;
|
||||
|
||||
changed = true;
|
||||
|
||||
@@ -729,12 +711,12 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int
|
||||
|
||||
static void JacobiSVD(float* At, size_t astep, float* W, float* Vt, size_t vstep, int m, int n, int n1=-1)
|
||||
{
|
||||
JacobiSVDImpl_(At, astep, W, Vt, vstep, m, n, !Vt ? 0 : n1 < 0 ? n : n1, FLT_MIN);
|
||||
JacobiSVDImpl_(At, astep, W, Vt, vstep, m, n, !Vt ? 0 : n1 < 0 ? n : n1, FLT_MIN, FLT_EPSILON*2);
|
||||
}
|
||||
|
||||
static void JacobiSVD(double* At, size_t astep, double* W, double* Vt, size_t vstep, int m, int n, int n1=-1)
|
||||
{
|
||||
JacobiSVDImpl_(At, astep, W, Vt, vstep, m, n, !Vt ? 0 : n1 < 0 ? n : n1, DBL_MIN);
|
||||
JacobiSVDImpl_(At, astep, W, Vt, vstep, m, n, !Vt ? 0 : n1 < 0 ? n : n1, DBL_MIN, DBL_EPSILON*10);
|
||||
}
|
||||
|
||||
/* y[0:m,0:n] += diag(a[0:1,0:m]) * x[0:m,0:n] */
|
||||
|
||||
@@ -319,7 +319,7 @@ void MatOp::augAssignXor(const MatExpr& expr, Mat& m) const
|
||||
{
|
||||
Mat temp;
|
||||
expr.op->assign(expr, temp);
|
||||
m /= temp;
|
||||
m ^= temp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ static void finalizeHdr(Mat& m)
|
||||
void Mat::create(int d, const int* _sizes, int _type)
|
||||
{
|
||||
int i;
|
||||
CV_Assert(0 <= d && _sizes && d <= CV_MAX_DIM && _sizes);
|
||||
CV_Assert(0 <= d && d <= CV_MAX_DIM && _sizes);
|
||||
_type = CV_MAT_TYPE(_type);
|
||||
|
||||
if( data && (d == dims || (d == 1 && dims <= 2)) && _type == type() )
|
||||
@@ -1546,10 +1546,10 @@ void _OutputArray::create(int dims, const int* sizes, int mtype, int i, bool all
|
||||
int _type = CV_MAT_TYPE(flags);
|
||||
for( size_t j = len0; j < len; j++ )
|
||||
{
|
||||
if( v[i].type() == _type )
|
||||
if( v[j].type() == _type )
|
||||
continue;
|
||||
CV_Assert( v[i].empty() );
|
||||
v[i].flags = (v[i].flags & ~CV_MAT_TYPE_MASK) | _type;
|
||||
CV_Assert( v[j].empty() );
|
||||
v[j].flags = (v[j].flags & ~CV_MAT_TYPE_MASK) | _type;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
// the use of this software, even if advised of the possibility of such damage.
|
||||
//
|
||||
//M*/
|
||||
|
||||
#include "precomp.hpp"
|
||||
#include "opencv2/core/opengl_interop_deprecated.hpp"
|
||||
#include "opencv2/core/gpumat.hpp"
|
||||
|
||||
@@ -999,25 +999,22 @@ static int normHamming(const uchar* a, int n)
|
||||
{
|
||||
int i = 0, result = 0;
|
||||
#if CV_NEON
|
||||
if (CPU_HAS_NEON_FEATURE)
|
||||
{
|
||||
uint32x4_t bits = vmovq_n_u32(0);
|
||||
for (; i <= n - 16; i += 16) {
|
||||
uint8x16_t A_vec = vld1q_u8 (a + i);
|
||||
uint8x16_t bitsSet = vcntq_u8 (A_vec);
|
||||
uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet);
|
||||
uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8);
|
||||
bits = vaddq_u32(bits, bitSet4);
|
||||
}
|
||||
uint64x2_t bitSet2 = vpaddlq_u32 (bits);
|
||||
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
|
||||
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
|
||||
uint32x4_t bits = vmovq_n_u32(0);
|
||||
for (; i <= n - 16; i += 16) {
|
||||
uint8x16_t A_vec = vld1q_u8 (a + i);
|
||||
uint8x16_t bitsSet = vcntq_u8 (A_vec);
|
||||
uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet);
|
||||
uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8);
|
||||
bits = vaddq_u32(bits, bitSet4);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
for( ; i <= n - 4; i += 4 )
|
||||
uint64x2_t bitSet2 = vpaddlq_u32 (bits);
|
||||
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
|
||||
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
|
||||
#else
|
||||
for( ; i <= n - 4; i += 4 )
|
||||
result += popCountTable[a[i]] + popCountTable[a[i+1]] +
|
||||
popCountTable[a[i+2]] + popCountTable[a[i+3]];
|
||||
#endif
|
||||
for( ; i < n; i++ )
|
||||
result += popCountTable[a[i]];
|
||||
return result;
|
||||
@@ -1027,27 +1024,24 @@ int normHamming(const uchar* a, const uchar* b, int n)
|
||||
{
|
||||
int i = 0, result = 0;
|
||||
#if CV_NEON
|
||||
if (CPU_HAS_NEON_FEATURE)
|
||||
{
|
||||
uint32x4_t bits = vmovq_n_u32(0);
|
||||
for (; i <= n - 16; i += 16) {
|
||||
uint8x16_t A_vec = vld1q_u8 (a + i);
|
||||
uint8x16_t B_vec = vld1q_u8 (b + i);
|
||||
uint8x16_t AxorB = veorq_u8 (A_vec, B_vec);
|
||||
uint8x16_t bitsSet = vcntq_u8 (AxorB);
|
||||
uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet);
|
||||
uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8);
|
||||
bits = vaddq_u32(bits, bitSet4);
|
||||
}
|
||||
uint64x2_t bitSet2 = vpaddlq_u32 (bits);
|
||||
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
|
||||
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
|
||||
uint32x4_t bits = vmovq_n_u32(0);
|
||||
for (; i <= n - 16; i += 16) {
|
||||
uint8x16_t A_vec = vld1q_u8 (a + i);
|
||||
uint8x16_t B_vec = vld1q_u8 (b + i);
|
||||
uint8x16_t AxorB = veorq_u8 (A_vec, B_vec);
|
||||
uint8x16_t bitsSet = vcntq_u8 (AxorB);
|
||||
uint16x8_t bitSet8 = vpaddlq_u8 (bitsSet);
|
||||
uint32x4_t bitSet4 = vpaddlq_u16 (bitSet8);
|
||||
bits = vaddq_u32(bits, bitSet4);
|
||||
}
|
||||
else
|
||||
uint64x2_t bitSet2 = vpaddlq_u32 (bits);
|
||||
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
|
||||
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
|
||||
#else
|
||||
for( ; i <= n - 4; i += 4 )
|
||||
result += popCountTable[a[i] ^ b[i]] + popCountTable[a[i+1] ^ b[i+1]] +
|
||||
popCountTable[a[i+2] ^ b[i+2]] + popCountTable[a[i+3] ^ b[i+3]];
|
||||
#endif
|
||||
for( ; i <= n - 4; i += 4 )
|
||||
result += popCountTable[a[i] ^ b[i]] + popCountTable[a[i+1] ^ b[i+1]] +
|
||||
popCountTable[a[i+2] ^ b[i+2]] + popCountTable[a[i+3] ^ b[i+3]];
|
||||
for( ; i < n; i++ )
|
||||
result += popCountTable[a[i] ^ b[i]];
|
||||
return result;
|
||||
|
||||
@@ -1551,3 +1551,16 @@ TEST(Core_Add, AddToColumnWhen4Rows)
|
||||
|
||||
ASSERT_EQ(0, countNonZero(m1 - m2));
|
||||
}
|
||||
|
||||
TEST(Core_round, CvRound)
|
||||
{
|
||||
ASSERT_EQ(2, cvRound(2.0));
|
||||
ASSERT_EQ(2, cvRound(2.1));
|
||||
ASSERT_EQ(-2, cvRound(-2.1));
|
||||
ASSERT_EQ(3, cvRound(2.8));
|
||||
ASSERT_EQ(-3, cvRound(-2.8));
|
||||
ASSERT_EQ(2, cvRound(2.5));
|
||||
ASSERT_EQ(4, cvRound(3.5));
|
||||
ASSERT_EQ(-2, cvRound(-2.5));
|
||||
ASSERT_EQ(-4, cvRound(-3.5));
|
||||
}
|
||||
@@ -454,3 +454,12 @@ protected:
|
||||
TEST(Core_InputOutput, huge) { CV_BigMatrixIOTest test; test.safe_run(); }
|
||||
*/
|
||||
|
||||
TEST(Core_InputOutput, FileStorage)
|
||||
{
|
||||
std::string file = cv::tempfile(".xml");
|
||||
cv::FileStorage f(file, cv::FileStorage::WRITE);
|
||||
|
||||
char arr[66];
|
||||
sprintf(arr, "sprintf is hell %d", 666);
|
||||
EXPECT_NO_THROW(f << arr);
|
||||
}
|
||||
|
||||
@@ -2487,6 +2487,35 @@ TEST(Core_SVBkSb, accuracy) { Core_SVBkSbTest test; test.safe_run(); }
|
||||
TEST(Core_Trace, accuracy) { Core_TraceTest test; test.safe_run(); }
|
||||
TEST(Core_SolvePoly, accuracy) { Core_SolvePolyTest test; test.safe_run(); }
|
||||
|
||||
|
||||
TEST(Core_SVD, flt)
|
||||
{
|
||||
float a[] = {
|
||||
1.23377746e+011f, -7.05490125e+010f, -4.18380882e+010f, -11693456.f,
|
||||
-39091328.f, 77492224.f, -7.05490125e+010f, 2.36211143e+011f,
|
||||
-3.51093473e+010f, 70773408.f, -4.83386156e+005f, -129560368.f,
|
||||
-4.18380882e+010f, -3.51093473e+010f, 9.25311222e+010f, -49052424.f,
|
||||
43922752.f, 12176842.f, -11693456.f, 70773408.f, -49052424.f, 8.40836094e+004f,
|
||||
5.17475293e+003f, -1.16122949e+004f, -39091328.f, -4.83386156e+005f,
|
||||
43922752.f, 5.17475293e+003f, 5.16047969e+004f, 5.68887842e+003f, 77492224.f,
|
||||
-129560368.f, 12176842.f, -1.16122949e+004f, 5.68887842e+003f,
|
||||
1.28060578e+005f
|
||||
};
|
||||
|
||||
float b[] = {
|
||||
283751232.f, 2.61604198e+009f, -745033216.f, 2.31125625e+005f,
|
||||
-4.52429188e+005f, -1.37596525e+006f
|
||||
};
|
||||
|
||||
Mat A(6, 6, CV_32F, a);
|
||||
Mat B(6, 1, CV_32F, b);
|
||||
Mat X, B1;
|
||||
solve(A, B, X, DECOMP_SVD);
|
||||
B1 = A*X;
|
||||
EXPECT_LE(norm(B1, B, NORM_L2 + NORM_RELATIVE), FLT_EPSILON*10);
|
||||
}
|
||||
|
||||
|
||||
// TODO: eigenvv, invsqrt, cbrt, fastarctan, (round, floor, ceil(?)),
|
||||
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ Maximally stable extremal region extractor. ::
|
||||
};
|
||||
|
||||
The class encapsulates all the parameters of the MSER extraction algorithm (see
|
||||
http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions). Also see http://opencv.willowgarage.com/wiki/documentation/cpp/features2d/MSER for useful comments and parameters description.
|
||||
http://en.wikipedia.org/wiki/Maximally_stable_extremal_regions). Also see http://code.opencv.org/projects/opencv/wiki/MSER for useful comments and parameters description.
|
||||
|
||||
|
||||
ORB
|
||||
|
||||
@@ -192,7 +192,7 @@ struct KeypointResponseGreater
|
||||
void KeyPointsFilter::retainBest(vector<KeyPoint>& keypoints, int n_points)
|
||||
{
|
||||
//this is only necessary if the keypoints size is greater than the number of desired points.
|
||||
if( n_points > 0 && keypoints.size() > (size_t)n_points )
|
||||
if( n_points >= 0 && keypoints.size() > (size_t)n_points )
|
||||
{
|
||||
if (n_points==0)
|
||||
{
|
||||
|
||||
@@ -456,7 +456,6 @@ struct Hamming
|
||||
ResultType operator()(Iterator1 a, Iterator2 b, size_t size, ResultType /*worst_dist*/ = -1) const
|
||||
{
|
||||
ResultType result = 0;
|
||||
#ifdef __GNUC__
|
||||
#ifdef __ARM_NEON__
|
||||
{
|
||||
uint32x4_t bits = vmovq_n_u32(0);
|
||||
@@ -473,7 +472,7 @@ struct Hamming
|
||||
result = vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),0);
|
||||
result += vgetq_lane_s32 (vreinterpretq_s32_u64(bitSet2),2);
|
||||
}
|
||||
#else
|
||||
#elif __GNUC__
|
||||
{
|
||||
//for portability just use unsigned long -- and use the __builtin_popcountll (see docs for __builtin_popcountll)
|
||||
typedef unsigned long long pop_t;
|
||||
@@ -493,8 +492,8 @@ struct Hamming
|
||||
result += __builtin_popcountll(a_final ^ b_final);
|
||||
}
|
||||
}
|
||||
#endif //NEON
|
||||
#else
|
||||
#else // NO NEON and NOT GNUC
|
||||
typedef unsigned long long pop_t;
|
||||
HammingLUT lut;
|
||||
result = lut(reinterpret_cast<const unsigned char*> (a),
|
||||
reinterpret_cast<const unsigned char*> (b), size * sizeof(pop_t));
|
||||
|
||||
@@ -3,7 +3,7 @@ if(ANDROID OR IOS)
|
||||
endif()
|
||||
|
||||
set(the_description "GPU-accelerated Computer Vision")
|
||||
ocv_add_module(gpu opencv_imgproc opencv_calib3d opencv_objdetect opencv_video opencv_nonfree opencv_photo opencv_legacy)
|
||||
ocv_add_module(gpu opencv_imgproc opencv_calib3d opencv_objdetect opencv_video opencv_photo opencv_legacy)
|
||||
|
||||
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/cuda")
|
||||
|
||||
@@ -28,9 +28,7 @@ if(HAVE_CUDA)
|
||||
|
||||
source_group("Src\\NVidia" FILES ${ncv_files})
|
||||
ocv_include_directories("src/nvidia" "src/nvidia/core" "src/nvidia/NPP_staging" ${CUDA_INCLUDE_DIRS})
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations /wd4211 /wd4201 /wd4100 /wd4505 /wd4408)
|
||||
string(REPLACE "-Wsign-promo" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations -Wshadow -Wunused-parameter /wd4211 /wd4201 /wd4100 /wd4505 /wd4408)
|
||||
|
||||
if(MSVC)
|
||||
if(NOT ENABLE_NOISY_WARNINGS)
|
||||
|
||||
@@ -5,109 +5,6 @@ Feature Detection and Description
|
||||
|
||||
|
||||
|
||||
gpu::SURF_GPU
|
||||
-------------
|
||||
.. ocv:class:: gpu::SURF_GPU
|
||||
|
||||
Class used for extracting Speeded Up Robust Features (SURF) from an image. ::
|
||||
|
||||
class SURF_GPU
|
||||
{
|
||||
public:
|
||||
enum KeypointLayout
|
||||
{
|
||||
X_ROW = 0,
|
||||
Y_ROW,
|
||||
LAPLACIAN_ROW,
|
||||
OCTAVE_ROW,
|
||||
SIZE_ROW,
|
||||
ANGLE_ROW,
|
||||
HESSIAN_ROW,
|
||||
ROWS_COUNT
|
||||
};
|
||||
|
||||
//! the default constructor
|
||||
SURF_GPU();
|
||||
//! the full constructor taking all the necessary parameters
|
||||
explicit SURF_GPU(double _hessianThreshold, int _nOctaves=4,
|
||||
int _nOctaveLayers=2, bool _extended=false, float _keypointsRatio=0.01f);
|
||||
|
||||
//! returns the descriptor size in float's (64 or 128)
|
||||
int descriptorSize() const;
|
||||
|
||||
//! upload host keypoints to device memory
|
||||
void uploadKeypoints(const vector<KeyPoint>& keypoints,
|
||||
GpuMat& keypointsGPU);
|
||||
//! download keypoints from device to host memory
|
||||
void downloadKeypoints(const GpuMat& keypointsGPU,
|
||||
vector<KeyPoint>& keypoints);
|
||||
|
||||
//! download descriptors from device to host memory
|
||||
void downloadDescriptors(const GpuMat& descriptorsGPU,
|
||||
vector<float>& descriptors);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
GpuMat& keypoints);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
GpuMat& keypoints, GpuMat& descriptors,
|
||||
bool useProvidedKeypoints = false,
|
||||
bool calcOrientation = true);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
std::vector<KeyPoint>& keypoints);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
std::vector<KeyPoint>& keypoints, GpuMat& descriptors,
|
||||
bool useProvidedKeypoints = false,
|
||||
bool calcOrientation = true);
|
||||
|
||||
void operator()(const GpuMat& img, const GpuMat& mask,
|
||||
std::vector<KeyPoint>& keypoints,
|
||||
std::vector<float>& descriptors,
|
||||
bool useProvidedKeypoints = false,
|
||||
bool calcOrientation = true);
|
||||
|
||||
void releaseMemory();
|
||||
|
||||
// SURF parameters
|
||||
double hessianThreshold;
|
||||
int nOctaves;
|
||||
int nOctaveLayers;
|
||||
bool extended;
|
||||
bool upright;
|
||||
|
||||
//! max keypoints = keypointsRatio * img.size().area()
|
||||
float keypointsRatio;
|
||||
|
||||
GpuMat sum, mask1, maskSum, intBuffer;
|
||||
|
||||
GpuMat det, trace;
|
||||
|
||||
GpuMat maxPosBuffer;
|
||||
};
|
||||
|
||||
|
||||
The class ``SURF_GPU`` implements Speeded Up Robust Features descriptor. There is a fast multi-scale Hessian keypoint detector that can be used to find the keypoints (which is the default option). But the descriptors can also be computed for the user-specified keypoints. Only 8-bit grayscale images are supported.
|
||||
|
||||
The class ``SURF_GPU`` can store results in the GPU and CPU memory. It provides functions to convert results between CPU and GPU version ( ``uploadKeypoints``, ``downloadKeypoints``, ``downloadDescriptors`` ). The format of CPU results is the same as ``SURF`` results. GPU results are stored in ``GpuMat``. The ``keypoints`` matrix is :math:`\texttt{nFeatures} \times 7` matrix with the ``CV_32FC1`` type.
|
||||
|
||||
* ``keypoints.ptr<float>(X_ROW)[i]`` contains x coordinate of the i-th feature.
|
||||
* ``keypoints.ptr<float>(Y_ROW)[i]`` contains y coordinate of the i-th feature.
|
||||
* ``keypoints.ptr<float>(LAPLACIAN_ROW)[i]`` contains the laplacian sign of the i-th feature.
|
||||
* ``keypoints.ptr<float>(OCTAVE_ROW)[i]`` contains the octave of the i-th feature.
|
||||
* ``keypoints.ptr<float>(SIZE_ROW)[i]`` contains the size of the i-th feature.
|
||||
* ``keypoints.ptr<float>(ANGLE_ROW)[i]`` contain orientation of the i-th feature.
|
||||
* ``keypoints.ptr<float>(HESSIAN_ROW)[i]`` contains the response of the i-th feature.
|
||||
|
||||
The ``descriptors`` matrix is :math:`\texttt{nFeatures} \times \texttt{descriptorSize}` matrix with the ``CV_32FC1`` type.
|
||||
|
||||
The class ``SURF_GPU`` uses some buffers and provides access to it. All buffers can be safely released between function calls.
|
||||
|
||||
.. seealso:: :ocv:class:`SURF`
|
||||
|
||||
|
||||
|
||||
gpu::FAST_GPU
|
||||
-------------
|
||||
.. ocv:class:: gpu::FAST_GPU
|
||||
|
||||
@@ -579,76 +579,6 @@ Releases all inner buffer's memory.
|
||||
|
||||
|
||||
|
||||
gpu::VIBE_GPU
|
||||
-------------
|
||||
.. ocv:class:: gpu::VIBE_GPU
|
||||
|
||||
Class used for background/foreground segmentation. ::
|
||||
|
||||
class VIBE_GPU
|
||||
{
|
||||
public:
|
||||
explicit VIBE_GPU(unsigned long rngSeed = 1234567);
|
||||
|
||||
void initialize(const GpuMat& firstFrame, Stream& stream = Stream::Null());
|
||||
|
||||
void operator()(const GpuMat& frame, GpuMat& fgmask, Stream& stream = Stream::Null());
|
||||
|
||||
void release();
|
||||
|
||||
...
|
||||
};
|
||||
|
||||
The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [VIBE2011]_.
|
||||
|
||||
|
||||
|
||||
gpu::VIBE_GPU::VIBE_GPU
|
||||
-----------------------
|
||||
The constructor.
|
||||
|
||||
.. ocv:function:: gpu::VIBE_GPU::VIBE_GPU(unsigned long rngSeed = 1234567)
|
||||
|
||||
:param rngSeed: Value used to initiate a random sequence.
|
||||
|
||||
Default constructor sets all parameters to default values.
|
||||
|
||||
|
||||
|
||||
gpu::VIBE_GPU::initialize
|
||||
-------------------------
|
||||
Initialize background model and allocates all inner buffers.
|
||||
|
||||
.. ocv:function:: void gpu::VIBE_GPU::initialize(const GpuMat& firstFrame, Stream& stream = Stream::Null())
|
||||
|
||||
:param firstFrame: First frame from video sequence.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::VIBE_GPU::operator()
|
||||
-------------------------
|
||||
Updates the background model and returns the foreground mask
|
||||
|
||||
.. ocv:function:: void gpu::VIBE_GPU::operator()(const GpuMat& frame, GpuMat& fgmask, Stream& stream = Stream::Null())
|
||||
|
||||
:param frame: Next video frame.
|
||||
|
||||
:param fgmask: The output foreground mask as an 8-bit binary image.
|
||||
|
||||
:param stream: Stream for the asynchronous version.
|
||||
|
||||
|
||||
|
||||
gpu::VIBE_GPU::release
|
||||
----------------------
|
||||
Releases all inner buffer's memory.
|
||||
|
||||
.. ocv:function:: void gpu::VIBE_GPU::release()
|
||||
|
||||
|
||||
|
||||
gpu::GMG_GPU
|
||||
------------
|
||||
.. ocv:class:: gpu::GMG_GPU
|
||||
@@ -1209,5 +1139,4 @@ Parse next video frame. Implementation must call this method after new frame was
|
||||
.. [MOG2001] P. KadewTraKuPong and R. Bowden. *An improved adaptive background mixture model for real-time tracking with shadow detection*. Proc. 2nd European Workshop on Advanced Video-Based Surveillance Systems, 2001
|
||||
.. [MOG2004] Z. Zivkovic. *Improved adaptive Gausian mixture model for background subtraction*. International Conference Pattern Recognition, UK, August, 2004
|
||||
.. [ShadowDetect2003] Prati, Mikic, Trivedi and Cucchiarra. *Detecting Moving Shadows...*. IEEE PAMI, 2003
|
||||
.. [VIBE2011] O. Barnich and M. Van D Roogenbroeck. *ViBe: A universal background subtraction algorithm for video sequences*. IEEE Transactions on Image Processing, 20(6) :1709-1724, June 2011
|
||||
.. [GMG2012] A. Godbehere, A. Matsukawa and K. Goldberg. *Visual Tracking of Human Visitors under Variable-Lighting Conditions for a Responsive Audio Art Installation*. American Control Conference, Montreal, June 2012
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or bpied warranties, including, but not limited to, the bpied
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or bpied warranties, including, but not limited to, the bpied
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or bpied warranties, including, but not limited to, the bpied
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or bpied warranties, including, but not limited to, the bpied
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// This software is provided by the copyright holders and contributors "as is" and
|
||||
// any express or bpied warranties, including, but not limited to, the bpied
|
||||
// any express or implied warranties, including, but not limited to, the implied
|
||||
// warranties of merchantability and fitness for a particular purpose are disclaimed.
|
||||
// In no event shall the Intel Corporation or contributors be liable for any direct,
|
||||
// indirect, incidental, special, exemplary, or consequential damages
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
//
|
||||
//M*/
|
||||
|
||||
|
||||
#ifndef __OPENCV_GPU_DEVICE_FUNCATTRIB_HPP_
|
||||
#define __OPENCV_GPU_DEVICE_FUNCATTRIB_HPP_
|
||||
|
||||
@@ -69,4 +68,4 @@ namespace cv { namespace gpu { namespace device
|
||||
}
|
||||
}}} // namespace cv { namespace gpu { namespace device
|
||||
|
||||
#endif /* __OPENCV_GPU_DEVICE_FUNCATTRIB_HPP_ */
|
||||
#endif /* __OPENCV_GPU_DEVICE_FUNCATTRIB_HPP_ */
|
||||
|
||||
@@ -43,7 +43,10 @@
|
||||
#ifndef __OPENCV_GPU_SCAN_HPP__
|
||||
#define __OPENCV_GPU_SCAN_HPP__
|
||||
|
||||
#include "common.hpp"
|
||||
#include "opencv2/gpu/device/common.hpp"
|
||||
#include "opencv2/gpu/device/utility.hpp"
|
||||
#include "opencv2/gpu/device/warp.hpp"
|
||||
#include "opencv2/gpu/device/warp_shuffle.hpp"
|
||||
|
||||
namespace cv { namespace gpu { namespace device
|
||||
{
|
||||
@@ -166,6 +169,82 @@ namespace cv { namespace gpu { namespace device
|
||||
static const int warp_log = 5;
|
||||
static const int warp_mask = 31;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
__device__ T warpScanInclusive(T idata, volatile T* s_Data, unsigned int tid)
|
||||
{
|
||||
#if __CUDA_ARCH__ >= 300
|
||||
const unsigned int laneId = cv::gpu::device::Warp::laneId();
|
||||
|
||||
// scan on shuffl functions
|
||||
#pragma unroll
|
||||
for (int i = 1; i <= (OPENCV_GPU_WARP_SIZE / 2); i *= 2)
|
||||
{
|
||||
const T n = cv::gpu::device::shfl_up(idata, i);
|
||||
if (laneId >= i)
|
||||
idata += n;
|
||||
}
|
||||
|
||||
return idata;
|
||||
#else
|
||||
unsigned int pos = 2 * tid - (tid & (OPENCV_GPU_WARP_SIZE - 1));
|
||||
s_Data[pos] = 0;
|
||||
pos += OPENCV_GPU_WARP_SIZE;
|
||||
s_Data[pos] = idata;
|
||||
|
||||
s_Data[pos] += s_Data[pos - 1];
|
||||
s_Data[pos] += s_Data[pos - 2];
|
||||
s_Data[pos] += s_Data[pos - 4];
|
||||
s_Data[pos] += s_Data[pos - 8];
|
||||
s_Data[pos] += s_Data[pos - 16];
|
||||
|
||||
return s_Data[pos];
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__device__ __forceinline__ T warpScanExclusive(T idata, volatile T* s_Data, unsigned int tid)
|
||||
{
|
||||
return warpScanInclusive(idata, s_Data, tid) - idata;
|
||||
}
|
||||
|
||||
template <int tiNumScanThreads, typename T>
|
||||
__device__ T blockScanInclusive(T idata, volatile T* s_Data, unsigned int tid)
|
||||
{
|
||||
if (tiNumScanThreads > OPENCV_GPU_WARP_SIZE)
|
||||
{
|
||||
//Bottom-level inclusive warp scan
|
||||
T warpResult = warpScanInclusive(idata, s_Data, tid);
|
||||
|
||||
//Save top elements of each warp for exclusive warp scan
|
||||
//sync to wait for warp scans to complete (because s_Data is being overwritten)
|
||||
__syncthreads();
|
||||
if ((tid & (OPENCV_GPU_WARP_SIZE - 1)) == (OPENCV_GPU_WARP_SIZE - 1))
|
||||
{
|
||||
s_Data[tid >> OPENCV_GPU_LOG_WARP_SIZE] = warpResult;
|
||||
}
|
||||
|
||||
//wait for warp scans to complete
|
||||
__syncthreads();
|
||||
|
||||
if (tid < (tiNumScanThreads / OPENCV_GPU_WARP_SIZE) )
|
||||
{
|
||||
//grab top warp elements
|
||||
T val = s_Data[tid];
|
||||
//calculate exclusive scan and write back to shared memory
|
||||
s_Data[tid] = warpScanExclusive(val, s_Data, tid);
|
||||
}
|
||||
|
||||
//return updated warp scans with exclusive scan results
|
||||
__syncthreads();
|
||||
|
||||
return warpResult + s_Data[tid >> OPENCV_GPU_LOG_WARP_SIZE];
|
||||
}
|
||||
else
|
||||
{
|
||||
return warpScanInclusive(idata, s_Data, tid);
|
||||
}
|
||||
}
|
||||
}}}
|
||||
|
||||
#endif // __OPENCV_GPU_SCAN_HPP__
|
||||
|
||||