diff --git a/.gitignore b/.gitignore index 741704db83..228365d9eb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,12 @@ Thumbs.db tags tegra/ +bin/ +CMakeFiles/ +*.sdf +*.opensdf +*.obj +*.stamp +*.depend +*.rule +*.tmp diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index 7e0243c456..c5a93ea8b6 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -29,10 +29,6 @@ if(MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) endif(MSVC) -if (HAVE_WINRT) - add_definitions(-DHAVE_WINRT) -endif() - add_library(${PNG_LIBRARY} STATIC ${lib_srcs} ${lib_hdrs}) target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES}) diff --git a/3rdparty/libpng/opencv-libpng.patch b/3rdparty/libpng/opencv-libpng.patch index 6ca96392a0..9bc0b69037 100644 --- a/3rdparty/libpng/opencv-libpng.patch +++ b/3rdparty/libpng/opencv-libpng.patch @@ -7,7 +7,7 @@ index 07b2b0b..e7824b8 100644 /* Memory model/platform independent fns */ #ifndef PNG_ABORT -# ifdef _WINDOWS_ -+# if defined(_WINDOWS_) && !defined(HAVE_WINRT) ++# if defined(_WINDOWS_) && !defined(WINRT) # define PNG_ABORT() ExitProcess(0) # else # define PNG_ABORT() abort() @@ -16,7 +16,7 @@ index 07b2b0b..e7824b8 100644 # define png_memset _fmemset #else -# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */ -+# if defined(_WINDOWS_) && !defined(HAVE_WINRT) /* Favor Windows over C runtime fns */ ++# if defined(_WINDOWS_) && !defined(WINRT) /* Favor Windows over C runtime fns */ # define CVT_PTR(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr) # define png_strlen lstrlenA diff --git a/3rdparty/libpng/pngpriv.h b/3rdparty/libpng/pngpriv.h index e7824b839e..880d2996f3 100644 --- a/3rdparty/libpng/pngpriv.h +++ b/3rdparty/libpng/pngpriv.h @@ -360,7 +360,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; /* Memory model/platform independent fns */ #ifndef PNG_ABORT -# if defined(_WINDOWS_) && !defined(HAVE_WINRT) +# if defined(_WINDOWS_) && !defined(WINRT) # define PNG_ABORT() ExitProcess(0) # else # define PNG_ABORT() abort() @@ -378,7 +378,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; # define png_memcpy _fmemcpy # define png_memset _fmemset #else -# if defined(_WINDOWS_) && !defined(HAVE_WINRT) /* Favor Windows over C runtime fns */ +# if defined(_WINDOWS_) && !defined(WINRT) /* Favor Windows over C runtime fns */ # define CVT_PTR(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr) # define png_strlen lstrlenA diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt index 7a974dbbce..ad8a466188 100644 --- a/3rdparty/libtiff/CMakeLists.txt +++ b/3rdparty/libtiff/CMakeLists.txt @@ -17,7 +17,7 @@ check_include_file(string.h HAVE_STRING_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(unistd.h HAVE_UNISTD_H) -if(WIN32 AND NOT HAVE_WINRT) +if(WIN32) set(USE_WIN32_FILEIO 1) endif() @@ -79,7 +79,7 @@ set(lib_srcs "${CMAKE_CURRENT_BINARY_DIR}/tif_config.h" ) -if(WIN32 AND NOT HAVE_WINRT) +if(WIN32) list(APPEND lib_srcs tif_win32.c) else() list(APPEND lib_srcs tif_unix.c) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e158e5692..02863f8a63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,12 @@ include(cmake/OpenCVMinDepVersions.cmake) if(CMAKE_GENERATOR MATCHES Xcode AND XCODE_VERSION VERSION_GREATER 4.3) cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) +elseif(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) + cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + #Required to resolve linker error issues due to incompatibility with CMake v3.0+ policies. + #CMake fails to find _fseeko() which leads to subsequent linker error. + #See details here: http://www.cmake.org/Wiki/CMake/Policies + cmake_policy(VERSION 2.8) else() cmake_minimum_required(VERSION "${MIN_VER_CMAKE}" FATAL_ERROR) endif() @@ -33,6 +39,13 @@ else(NOT CMAKE_TOOLCHAIN_FILE) set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory") endif(NOT CMAKE_TOOLCHAIN_FILE) +if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) + set(WINRT TRUE) +endif(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) + +if(WINRT) + add_definitions(-DWINRT -DNO_GETENV) +endif() if(POLICY CMP0022) cmake_policy(SET CMP0022 OLD) @@ -120,66 +133,66 @@ endif() # Optional 3rd party components # =================================================== -OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O" ON IF IOS) OCV_OPTION(WITH_CARBON "Use Carbon for UI instead of Cocoa" OFF IF APPLE ) -OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" ON IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (NOT IOS) ) -OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (NOT IOS) ) -OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (NOT IOS) ) +OCV_OPTION(WITH_VTK "Include VTK library support (and build opencv_viz module eiher)" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_CUDA "Include NVidia Cuda Runtime support" ON IF (NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_CUFFT "Include NVidia Cuda Fast Fourier Transform (FFT) library support" ON IF (NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_CUBLAS "Include NVidia Cuda Basic Linear Algebra Subprograms (BLAS) library support" OFF IF (NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_NVCUVID "Include NVidia Video Decoding library support" OFF IF (NOT IOS AND NOT APPLE) ) -OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON) +OCV_OPTION(WITH_EIGEN "Include Eigen2/Eigen3 support" ON IF (NOT WINRT) ) 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_FFMPEG "Include FFMPEG support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT ANDROID) ) OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)" OFF ) OCV_OPTION(WITH_GTK "Include GTK support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_GTK_2_X "Use GTK version 2" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) ) -OCV_OPTION(WITH_IPP "Include Intel IPP support" ON IF (X86_64 OR X86) ) +OCV_OPTION(WITH_IPP "Include Intel IPP support" ON IF (X86_64 OR X86) AND NOT WINRT) OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) ) OCV_OPTION(WITH_JPEG "Include JPEG support" ON) -OCV_OPTION(WITH_WEBP "Include WebP support" ON IF (NOT IOS) ) -OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) ) -OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID) ) -OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_OPENNI2 "Include OpenNI2 support" OFF IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_WEBP "Include WebP support" ON IF (NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT WINRT) ) +OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_OPENNI2 "Include OpenNI2 support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) 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_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_WIN32UI "Build with Win32 UI Backend support" ON IF WIN32 AND NOT WINRT) 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_TBB "Include Intel TBB support" OFF IF (NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF) -OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF WIN32 ) +OCV_OPTION(WITH_CSTRIPES "Include C= support" OFF IF (WIN32 AND NOT WINRT) ) 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_LIBV4L "Use libv4l for Video 4 Linux support" ON IF (UNIX AND NOT ANDROID) ) -OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON IF (WIN32 AND NOT ARM) ) +OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON IF (WIN32 AND NOT ARM AND NOT WINRT) ) OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" OFF IF WIN32 ) -OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID) ) +OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT WINRT) ) OCV_OPTION(WITH_XINE "Include Xine support (GPL)" OFF IF (UNIX AND NOT APPLE AND NOT ANDROID) ) OCV_OPTION(WITH_CLP "Include Clp support (EPL)" OFF) -OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" NOT ANDROID IF (NOT IOS) ) +OCV_OPTION(WITH_OPENCL "Include OpenCL Runtime support" NOT ANDROID IF (NOT IOS AND NOT WINRT) ) OCV_OPTION(WITH_OPENCL_SVM "Include OpenCL Shared Virtual Memory support" OFF ) # experimental -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) ) -OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON IF WIN32 ) -OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF WIN32 ) +OCV_OPTION(WITH_OPENCLAMDFFT "Include AMD OpenCL FFT library support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) +OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON IF (WIN32 AND NOT WINRT) ) +OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF IF (WIN32 AND NOT WINRT) ) OCV_OPTION(WITH_IPP_A "Include Intel IPP_A support" OFF IF (MSVC OR X86 OR X86_64) ) -OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF IF (NOT ANDROID AND NOT IOS) ) +OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) ) # OpenCV build components # =================================================== OCV_OPTION(BUILD_SHARED_LIBS "Build shared libraries (.dll/.so) instead of static ones (.lib/.a)" NOT (ANDROID OR IOS) ) -OCV_OPTION(BUILD_opencv_apps "Build utility applications (used for example to train classifiers)" (NOT ANDROID) IF (NOT IOS) ) +OCV_OPTION(BUILD_opencv_apps "Build utility applications (used for example to train classifiers)" (NOT ANDROID AND NOT WINRT) IF (NOT IOS) ) OCV_OPTION(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" ON IF ANDROID ) -OCV_OPTION(BUILD_DOCS "Create build rules for OpenCV Documentation" ON ) +OCV_OPTION(BUILD_DOCS "Create build rules for OpenCV Documentation" ON IF NOT WINRT) OCV_OPTION(BUILD_EXAMPLES "Build all examples" OFF ) -OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command" ON ) -OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT IOS) ) -OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT IOS) ) +OCV_OPTION(BUILD_PACKAGE "Enables 'make package_source' command" ON IF NOT WINRT) +OCV_OPTION(BUILD_PERF_TESTS "Build performance tests" ON IF (NOT IOS AND NOT WINRT) ) +OCV_OPTION(BUILD_TESTS "Build accuracy & regression tests" ON IF (NOT IOS AND NOT WINRT) ) OCV_OPTION(BUILD_WITH_DEBUG_INFO "Include debug info into debug libs (not MSCV only)" ON ) OCV_OPTION(BUILD_WITH_STATIC_CRT "Enables use of staticaly linked CRT for staticaly linked OpenCV" ON IF MSVC ) OCV_OPTION(BUILD_WITH_DYNAMIC_IPP "Enables dynamic linking of IPP (only for standalone IPP)" OFF ) @@ -194,7 +207,7 @@ OCV_OPTION(BUILD_TIFF "Build libtiff from source" WIN32 O OCV_OPTION(BUILD_JASPER "Build libjasper from source" WIN32 OR ANDROID OR APPLE ) 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_OPENEXR "Build openexr from source" (WIN32 OR ANDROID OR APPLE) AND NOT WINRT) OCV_OPTION(BUILD_TBB "Download and build TBB from source" ANDROID ) # OpenCV installation options @@ -229,8 +242,6 @@ OCV_OPTION(ENABLE_NEON "Enable NEON instructions" OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OFF IF CMAKE_COMPILER_IS_GNUCXX AND (ARM OR AARCH64 OR IOS) ) OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF ) OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF ) -OCV_OPTION(ENABLE_WINRT_MODE "Build with Windows Runtime support" OFF IF WIN32 ) -OCV_OPTION(ENABLE_WINRT_MODE_NATIVE "Build with Windows Runtime native C++ support" OFF IF WIN32 ) OCV_OPTION(ANDROID_EXAMPLES_WITH_LIBS "Build binaries of Android examples with native libraries" OFF IF ANDROID ) OCV_OPTION(ENABLE_IMPL_COLLECTION "Collect implementation data on function call" OFF ) @@ -759,11 +770,12 @@ endif() # ================== Windows RT features ================== if(WIN32) status("") - status(" Windows RT support:" HAVE_WINRT THEN YES ELSE NO) - if (ENABLE_WINRT_MODE OR ENABLE_WINRT_MODE_NATIVE) - status(" Windows SDK v8.0:" ${WINDOWS_SDK_PATH}) - status(" Visual Studio 2012:" ${VISUAL_STUDIO_PATH}) - endif() +status(" Windows RT support:" WINRT THEN YES ELSE NO) + if(WINRT) + status(" Building for Microsoft platform: " ${CMAKE_SYSTEM_NAME}) + status(" Building for architectures: " ${CMAKE_VS_EFFECTIVE_PLATFORMS}) + status(" Building for version: " ${CMAKE_SYSTEM_VERSION}) + endif() endif(WIN32) # ========================== GUI ========================== @@ -913,7 +925,7 @@ endif(DEFINED WITH_OPENNI) if(DEFINED WITH_OPENNI2) status(" OpenNI2:" HAVE_OPENNI2 THEN "YES (ver ${OPENNI2_VERSION_STRING}, build ${OPENNI2_VERSION_BUILD})" - ELSE NO) + ELSE NO) endif(DEFINED WITH_OPENNI2) if(DEFINED WITH_PVAPI) diff --git a/cmake/OpenCVCRTLinkage.cmake b/cmake/OpenCVCRTLinkage.cmake index 7b7fcad7ec..2168c72e65 100644 --- a/cmake/OpenCVCRTLinkage.cmake +++ b/cmake/OpenCVCRTLinkage.cmake @@ -2,47 +2,37 @@ if(NOT MSVC) message(FATAL_ERROR "CRT options are available only for MSVC") endif() -#INCLUDE (CheckIncludeFiles) +#if (${CMAKE_SYSTEM_NAME} MATCHES "WindowsStore" OR ${CMAKE_SYSTEM_NAME} MATCHES "WindowsPhone") +# set(WINRT TRUE) -set(HAVE_WINRT FALSE) - -# search Windows Platform SDK -message(STATUS "Checking for Windows Platform SDK") -GET_FILENAME_COMPONENT(WINDOWS_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE) -if(WINDOWS_SDK_PATH STREQUAL "") - set(HAVE_MSPDK FALSE) - message(STATUS "Windows Platform SDK 8.0 was not found") -else() - set(HAVE_MSPDK TRUE) +if (WINRT) + add_definitions(/DWINVER=_WIN32_WINNT_WIN8 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=_WIN32_WINNT_WIN8) endif() -#search for Visual Studio 11.0 install directory -message(STATUS "Checking for Visual Studio 2012") -GET_FILENAME_COMPONENT(VISUAL_STUDIO_PATH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir] REALPATH CACHE) -if(VISUAL_STUDIO_PATH STREQUAL "") - set(HAVE_MSVC2012 FALSE) - message(STATUS "Visual Studio 2012 was not found") -else() - set(HAVE_MSVC2012 TRUE) -endif() +# Removing LNK4075 warnings for debug WinRT builds +# "LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification" +# "LNK4075: ignoring '/INCREMENTAL' due to '/OPT:REF' specification" +if(MSVC AND WINRT) + # Optional verification checks since we don't know existing contents of variables below + string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}") + string(REPLACE "/OPT:REF " "/OPT:NOREF " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}") + string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}") + string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}") -try_compile(HAVE_WINRT_SDK - "${OpenCV_BINARY_DIR}" - "${OpenCV_SOURCE_DIR}/cmake/checks/winrttest.cpp") + string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}") + string(REPLACE "/OPT:REF " "/OPT:NORE F" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}") + string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}") + string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}") -if(ENABLE_WINRT_MODE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK) - set(HAVE_WINRT TRUE) - set(HAVE_WINRT_CX TRUE) -elseif(ENABLE_WINRT_MODE_NATIVE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK) - set(HAVE_WINRT TRUE) - set(HAVE_WINRT_CX FALSE) -endif() + string(REPLACE "/OPT:ICF " "/OPT:NOICF " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}") + string(REPLACE "/OPT:REF " "/OPT:NOREF " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}") + string(REPLACE "/INCREMENTAL:YES " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}") + string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}") -if(HAVE_WINRT) - add_definitions(/DWINVER=0x0602 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=0x0602) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /appcontainer") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /appcontainer") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /appcontainer") + # Mandatory + set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF") + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF") + set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF") endif() if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT) diff --git a/cmake/OpenCVConfig.cmake b/cmake/OpenCVConfig.cmake index 38117248af..dfd7e8f268 100644 --- a/cmake/OpenCVConfig.cmake +++ b/cmake/OpenCVConfig.cmake @@ -65,6 +65,9 @@ if(MSVC) if(CMAKE_CL_64) set(OpenCV_ARCH x64) set(OpenCV_TBB_ARCH intel64) + elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm")) + # see Modules/CmakeGenericSystem.cmake + set(OpenCV_ARCH ARM) else() set(OpenCV_ARCH x86) set(OpenCV_TBB_ARCH ia32) diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake index 55156ddf88..72d939917a 100644 --- a/cmake/OpenCVDetectCXXCompiler.cmake +++ b/cmake/OpenCVDetectCXXCompiler.cmake @@ -127,6 +127,9 @@ endif() if(MSVC) if(CMAKE_CL_64) set(OpenCV_ARCH x64) + elseif((CMAKE_GENERATOR MATCHES "ARM") OR ("${arch_hint}" STREQUAL "ARM") OR (CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm")) + # see Modules/CmakeGenericSystem.cmake + set(OpenCV_ARCH ARM) else() set(OpenCV_ARCH x86) endif() diff --git a/cmake/OpenCVDetectOpenCL.cmake b/cmake/OpenCVDetectOpenCL.cmake index ce76ad1732..67e10ede89 100644 --- a/cmake/OpenCVDetectOpenCL.cmake +++ b/cmake/OpenCVDetectOpenCL.cmake @@ -10,6 +10,11 @@ else(APPLE) set(OPENCL_INCLUDE_DIR "${OpenCV_SOURCE_DIR}/3rdparty/include/opencl/1.2") endif(APPLE) +if(WINRT) + set(OPENCL_FOUND NO) + set(HAVE_OPENCL_STATIC OFF) +endif(WINRT) + if(OPENCL_FOUND) if(NOT HAVE_OPENCL_STATIC) try_compile(__VALID_OPENCL @@ -24,7 +29,9 @@ if(OPENCL_FOUND) endif() endif() - set(HAVE_OPENCL 1) + if(NOT WINRT) + set(HAVE_OPENCL 1) + endif() if(WITH_OPENCL_SVM) set(HAVE_OPENCL_SVM 1) diff --git a/cmake/templates/cvconfig.h.in b/cmake/templates/cvconfig.h.in index f8c1c40357..9900eaeaf6 100644 --- a/cmake/templates/cvconfig.h.in +++ b/cmake/templates/cvconfig.h.in @@ -169,9 +169,6 @@ /* Win32 UI */ #cmakedefine HAVE_WIN32UI -/* Windows Runtime support */ -#cmakedefine HAVE_WINRT - /* XIMEA camera support */ #cmakedefine HAVE_XIMEA diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index 7052ce615a..c45760c654 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -3,11 +3,10 @@ ocv_add_module(core PRIVATE_REQUIRED ${ZLIB_LIBRARIES} "${OPENCL_LIBRARIES}" OPTIONAL opencv_cudev WRAP java python) -if(HAVE_WINRT_CX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") -endif() -if(HAVE_WINRT) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS /Gm- /AI\"${WINDOWS_SDK_PATH}/References/CommonConfiguration/Neutral\" /AI\"${VISUAL_STUDIO_PATH}/vcpackages\"") +set(extra_libs "") + +if(WINRT AND CMAKE_SYSTEM_NAME MATCHES WindowsStore AND CMAKE_SYSTEM_VERSION MATCHES "8.0") + list(APPEND extra_libs ole32.lib) endif() if(HAVE_CUDA) @@ -24,7 +23,7 @@ ocv_glob_module_sources(SOURCES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version HEADERS ${lib_cuda_hdrs} ${lib_cuda_hdrs_detail}) ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS}) -ocv_create_module() +ocv_create_module(${extra_libs}) ocv_add_accuracy_tests() ocv_add_perf_tests() diff --git a/modules/core/src/glob.cpp b/modules/core/src/glob.cpp index 93dc72ff81..e0c7f66a3a 100644 --- a/modules/core/src/glob.cpp +++ b/modules/core/src/glob.cpp @@ -56,14 +56,14 @@ namespace struct DIR { -#ifdef HAVE_WINRT +#ifdef WINRT WIN32_FIND_DATAW data; #else WIN32_FIND_DATA data; #endif HANDLE handle; dirent ent; -#ifdef HAVE_WINRT +#ifdef WINRT DIR() { } ~DIR() { @@ -77,7 +77,7 @@ namespace { DIR* dir = new DIR; dir->ent.d_name = 0; -#ifdef HAVE_WINRT +#ifdef WINRT cv::String full_path = cv::String(path) + "\\*"; wchar_t wfull_path[MAX_PATH]; size_t copied = mbstowcs(wfull_path, full_path.c_str(), MAX_PATH); @@ -99,7 +99,7 @@ namespace dirent* readdir(DIR* dir) { -#ifdef HAVE_WINRT +#ifdef WINRT if (dir->ent.d_name != 0) { if (::FindNextFileW(dir->handle, &dir->data) != TRUE) @@ -147,7 +147,7 @@ static bool isDir(const cv::String& path, DIR* dir) else { WIN32_FILE_ATTRIBUTE_DATA all_attrs; -#ifdef HAVE_WINRT +#ifdef WINRT wchar_t wpath[MAX_PATH]; size_t copied = mbstowcs(wpath, path.c_str(), MAX_PATH); CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1)); diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index f7117d8a71..6a36ddbae3 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -64,7 +64,15 @@ // TODO Move to some common place static bool getBoolParameter(const char* name, bool defaultValue) { +/* + * If your system doesn't support getenv(), define NO_GETENV to disable + * this feature. + */ +#ifdef NO_GETENV + const char* envValue = NULL; +#else const char* envValue = getenv(name); +#endif if (envValue == NULL) { return defaultValue; @@ -85,7 +93,7 @@ static bool getBoolParameter(const char* name, bool defaultValue) // TODO Move to some common place static size_t getConfigurationParameterForSize(const char* name, size_t defaultValue) { -#ifdef HAVE_WINRT +#ifdef NO_GETENV const char* envValue = NULL; #else const char* envValue = getenv(name); @@ -728,7 +736,7 @@ static void* initOpenCLAndLoad(const char* funcname) static HMODULE handle = 0; if (!handle) { -#ifndef HAVE_WINRT +#ifndef WINRT if(!initialized) { handle = LoadLibraryA("OpenCL.dll"); @@ -2231,7 +2239,7 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr, return true; } -#ifdef HAVE_WINRT +#ifdef WINRT static cl_device_id selectOpenCLDevice() { return NULL; diff --git a/modules/core/src/parallel.cpp b/modules/core/src/parallel.cpp index 1fb980d922..4dde2adeae 100644 --- a/modules/core/src/parallel.cpp +++ b/modules/core/src/parallel.cpp @@ -69,7 +69,7 @@ #define HAVE_GCD #endif -#if defined _MSC_VER && _MSC_VER >= 1600 +#if defined _MSC_VER && _MSC_VER >= 1600 && !defined(WINRT) #define HAVE_CONCURRENCY #endif @@ -458,7 +458,7 @@ int cv::getNumberOfCPUs(void) { #if defined WIN32 || defined _WIN32 SYSTEM_INFO sysinfo; -#if defined(_M_ARM) || defined(_M_X64) || defined(HAVE_WINRT) +#if defined(_M_ARM) || defined(_M_X64) || defined(WINRT) GetNativeSystemInfo( &sysinfo ); #else GetSystemInfo( &sysinfo ); diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index 23617c84df..fed5c9e4ea 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -109,7 +109,7 @@ #endif #endif -#ifdef HAVE_WINRT +#ifdef WINRT #include #ifndef __cplusplus_winrt #include @@ -159,7 +159,7 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix) UINT(g.Data4[2]), UINT(g.Data4[3]), UINT(g.Data4[4]), UINT(g.Data4[5]), UINT(g.Data4[6]), UINT(g.Data4[7])); - return prefix + std::wstring(guidStr); + return prefix.append(std::wstring(guidStr)); } #endif @@ -542,12 +542,12 @@ String format( const char* fmt, ... ) String tempfile( const char* suffix ) { String fname; -#ifndef HAVE_WINRT +#ifndef WINRT const char *temp_dir = getenv("OPENCV_TEMP_PATH"); #endif #if defined WIN32 || defined _WIN32 -#ifdef HAVE_WINRT +#ifdef WINRT RoInitialize(RO_INIT_MULTITHREADED); std::wstring temp_dir = L""; const wchar_t* opencv_temp_dir = GetTempPathWinRT().c_str(); @@ -559,7 +559,7 @@ String tempfile( const char* suffix ) if (temp_file.empty()) return String(); - temp_file = temp_dir + std::wstring(L"\\") + temp_file; + temp_file = temp_dir.append(std::wstring(L"\\")).append(temp_file); DeleteFileW(temp_file.c_str()); char aname[MAX_PATH]; @@ -955,7 +955,7 @@ public: #pragma warning(disable:4505) // unreferenced local function has been removed #endif -#ifdef HAVE_WINRT +#ifdef WINRT // using C++11 thread attribute for local thread data static __declspec( thread ) TLSStorage* g_tlsdata = NULL; @@ -1006,10 +1006,10 @@ public: } return d; } -#endif //HAVE_WINRT +#endif //WINRT #if defined CVAPI_EXPORTS && defined WIN32 && !defined WINCE -#ifdef HAVE_WINRT +#ifdef WINRT #pragma warning(disable:4447) // Disable warning 'main' signature found without threading model #endif diff --git a/modules/cudaarithm/CMakeLists.txt b/modules/cudaarithm/CMakeLists.txt index e13bb7b72b..29155560ef 100644 --- a/modules/cudaarithm/CMakeLists.txt +++ b/modules/cudaarithm/CMakeLists.txt @@ -1,4 +1,4 @@ -if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) +if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) ocv_module_disable(cudaarithm) endif() diff --git a/modules/cudacodec/CMakeLists.txt b/modules/cudacodec/CMakeLists.txt index 31877e864f..f2e955b6cd 100644 --- a/modules/cudacodec/CMakeLists.txt +++ b/modules/cudacodec/CMakeLists.txt @@ -1,4 +1,4 @@ -if(IOS OR APPLE OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) +if(IOS OR APPLE OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) ocv_module_disable(cudacodec) endif() diff --git a/modules/cudafeatures2d/CMakeLists.txt b/modules/cudafeatures2d/CMakeLists.txt index 861d22f279..af1945a250 100644 --- a/modules/cudafeatures2d/CMakeLists.txt +++ b/modules/cudafeatures2d/CMakeLists.txt @@ -1,4 +1,4 @@ -if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) +if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) ocv_module_disable(cudafeatures2d) endif() diff --git a/modules/cudafilters/CMakeLists.txt b/modules/cudafilters/CMakeLists.txt index 93e821293d..04f2d19212 100644 --- a/modules/cudafilters/CMakeLists.txt +++ b/modules/cudafilters/CMakeLists.txt @@ -1,4 +1,4 @@ -if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) +if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) ocv_module_disable(cudafilters) endif() diff --git a/modules/cudaimgproc/CMakeLists.txt b/modules/cudaimgproc/CMakeLists.txt index 409ca6a232..84ee2f91ba 100644 --- a/modules/cudaimgproc/CMakeLists.txt +++ b/modules/cudaimgproc/CMakeLists.txt @@ -1,4 +1,4 @@ -if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) +if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) ocv_module_disable(cudaimgproc) endif() diff --git a/modules/cudaoptflow/CMakeLists.txt b/modules/cudaoptflow/CMakeLists.txt index 0469935500..5db2b096c2 100644 --- a/modules/cudaoptflow/CMakeLists.txt +++ b/modules/cudaoptflow/CMakeLists.txt @@ -1,4 +1,4 @@ -if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) +if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) ocv_module_disable(cudaoptflow) endif() diff --git a/modules/cudastereo/CMakeLists.txt b/modules/cudastereo/CMakeLists.txt index a00fa15ed1..982609b82f 100644 --- a/modules/cudastereo/CMakeLists.txt +++ b/modules/cudastereo/CMakeLists.txt @@ -1,4 +1,4 @@ -if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) +if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) ocv_module_disable(cudastereo) endif() diff --git a/modules/cudawarping/CMakeLists.txt b/modules/cudawarping/CMakeLists.txt index fa99e9d04b..5d0fa4ad93 100644 --- a/modules/cudawarping/CMakeLists.txt +++ b/modules/cudawarping/CMakeLists.txt @@ -1,4 +1,4 @@ -if(IOS OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) +if(IOS OR WINRT OR (NOT HAVE_CUDA AND NOT BUILD_CUDA_STUBS)) ocv_module_disable(cudawarping) endif() diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index e9d496f33b..2a6f0b1d8c 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -1,3 +1,7 @@ +if (WINRT) + ocv_module_disable(highgui) +endif() + set(the_description "High-level GUI and Media I/O") ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL opencv_androidcamera WRAP python) @@ -7,7 +11,8 @@ ocv_add_module(highgui opencv_imgproc opencv_imgcodecs opencv_videoio OPTIONAL o # Jose Luis Blanco, 2008 # ---------------------------------------------------------------------------- -if(HAVE_WINRT_CX) +# Compilation with /ZW is not allowed for *.c files +if(HAVE_WINRT_CX AND NOT WINRT) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") endif() diff --git a/modules/imgcodecs/CMakeLists.txt b/modules/imgcodecs/CMakeLists.txt index f7bd8f4b11..50e2d5da64 100644 --- a/modules/imgcodecs/CMakeLists.txt +++ b/modules/imgcodecs/CMakeLists.txt @@ -1,3 +1,7 @@ +if(WINRT) + ocv_module_disable(imgcodecs) +endif() + set(the_description "Image codecs") ocv_add_module(imgcodecs opencv_imgproc WRAP java python) @@ -9,7 +13,7 @@ ocv_add_module(imgcodecs opencv_imgproc WRAP java python) ocv_clear_vars(GRFMT_LIBS) -if(HAVE_WINRT_CX) +if(HAVE_WINRT_CX AND NOT WINRT) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") endif() diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index 7acc4dfb73..e38ec1f198 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -1,7 +1,7 @@ # ---------------------------------------------------------------------------- # CMake file for java support # ---------------------------------------------------------------------------- -if(IOS OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)) +if(IOS OR WINRT OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)) OR BUILD_opencv_world ) ocv_module_disable(java) diff --git a/modules/python/CMakeLists.txt b/modules/python/CMakeLists.txt index 5339efecf0..37673da345 100644 --- a/modules/python/CMakeLists.txt +++ b/modules/python/CMakeLists.txt @@ -9,7 +9,7 @@ if((WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug") ocv_module_disable(python3) endif() -if(ANDROID OR IOS) +if(ANDROID OR IOS OR WINRT) ocv_module_disable(python2) ocv_module_disable(python3) endif() diff --git a/modules/superres/CMakeLists.txt b/modules/superres/CMakeLists.txt index 03809ef66b..7c3fc14a17 100644 --- a/modules/superres/CMakeLists.txt +++ b/modules/superres/CMakeLists.txt @@ -1,4 +1,4 @@ -if(IOS) +if(IOS OR WINRT) ocv_module_disable(superres) endif() diff --git a/modules/ts/CMakeLists.txt b/modules/ts/CMakeLists.txt index 9727c9a8c5..9d1e40c9c3 100644 --- a/modules/ts/CMakeLists.txt +++ b/modules/ts/CMakeLists.txt @@ -1,6 +1,6 @@ set(the_description "The ts module") -if(IOS) +if(IOS OR WINRT) ocv_module_disable(ts) endif() diff --git a/modules/ts/include/opencv2/ts.hpp b/modules/ts/include/opencv2/ts.hpp index c1b68a0c0f..8d1c2c0fd5 100644 --- a/modules/ts/include/opencv2/ts.hpp +++ b/modules/ts/include/opencv2/ts.hpp @@ -6,7 +6,7 @@ #include "cvconfig.h" -#ifdef HAVE_WINRT +#ifdef WINRT #pragma warning(disable:4447) // Disable warning 'main' signature found without threading model #endif diff --git a/modules/videoio/CMakeLists.txt b/modules/videoio/CMakeLists.txt index 61a517a87b..0b4f391c5d 100644 --- a/modules/videoio/CMakeLists.txt +++ b/modules/videoio/CMakeLists.txt @@ -1,3 +1,7 @@ +if(WINRT) + ocv_module_disable(videoio) +endif() + set(the_description "Media I/O") ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidcamera WRAP java python) @@ -7,7 +11,7 @@ ocv_add_module(videoio opencv_imgproc opencv_imgcodecs OPTIONAL opencv_androidca # Jose Luis Blanco, 2008 # ---------------------------------------------------------------------------- -if(HAVE_WINRT_CX) +if(HAVE_WINRT_CX AND NOT WINRT) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") endif() diff --git a/modules/videoio/src/cap_ffmpeg.cpp b/modules/videoio/src/cap_ffmpeg.cpp index f448ed8b88..b4348eaa05 100644 --- a/modules/videoio/src/cap_ffmpeg.cpp +++ b/modules/videoio/src/cap_ffmpeg.cpp @@ -85,7 +85,7 @@ private: icvInitFFMPEG() { #if defined WIN32 || defined _WIN32 - # ifdef HAVE_WINRT + # ifdef WINRT const wchar_t* module_name = L"opencv_ffmpeg" CVAUX_STRW(CV_MAJOR_VERSION) CVAUX_STRW(CV_MINOR_VERSION) CVAUX_STRW(CV_SUBMINOR_VERSION) #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__) diff --git a/modules/videoio/src/cap_msmf.cpp b/modules/videoio/src/cap_msmf.cpp index 3d62eef287..7f4179a816 100644 --- a/modules/videoio/src/cap_msmf.cpp +++ b/modules/videoio/src/cap_msmf.cpp @@ -86,7 +86,7 @@ #include -#ifdef HAVE_WINRT +#ifdef WINRT // for ComPtr usage #include #ifdef __cplusplus_winrt @@ -266,7 +266,7 @@ public: #endif struct IMFMediaType; -#ifndef HAVE_WINRT +#ifndef WINRT struct IMFActivate; struct IMFMediaSource; #endif @@ -406,7 +406,7 @@ private: ImageGrabberCallback& operator=(const ImageGrabberCallback&); // Declared to fix compilation warning. }; -#ifdef HAVE_WINRT +#ifdef WINRT extern const __declspec(selectany) WCHAR RuntimeClass_CV_ImageGrabberWinRT[] = L"cv.ImageGrabberWinRT"; class ImageGrabberWinRT : @@ -547,7 +547,7 @@ public: CamParametrs getParametrs(); void setParametrs(CamParametrs parametrs); void setEmergencyStopEvent(void *userData, void(*func)(int, void *)); -#ifdef HAVE_WINRT +#ifdef WINRT long readInfoOfDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice, unsigned int Num); void waitForDevice() { @@ -593,7 +593,7 @@ private: std::map vd_CaptureFormats; std::vector vd_CurrentFormats; IMFMediaSource *vd_pSource; -#ifdef HAVE_WINRT +#ifdef WINRT MAKE_WRL_AGILE_REF(_MediaCapture) vd_pMedCap; EventRegistrationToken vd_cookie; ImageGrabberWinRT *vd_pImGr; @@ -608,7 +608,7 @@ private: long setDeviceFormat(IMFMediaSource *pSource, unsigned long dwFormatIndex); void buildLibraryofTypes(); int findType(unsigned int size, unsigned int frameRate = 0); -#ifdef HAVE_WINRT +#ifdef WINRT HRESULT enumerateCaptureFormats(MAKE_WRL_REF(_MediaCapture) pSource); long setDeviceFormat(MAKE_WRL_REF(_MediaCapture) pSource, unsigned long dwFormatIndex, MAKE_WRL_REF(_AsyncAction)* pAction); long resetDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice); @@ -627,7 +627,7 @@ class videoDevices { public: ~videoDevices(void); -#ifdef HAVE_WINRT +#ifdef WINRT long initDevices(_DeviceClass devClass); void waitInit() { if (vds_enumTask) { @@ -646,7 +646,7 @@ public: void clearDevices(); private: UINT32 count; -#ifdef HAVE_WINRT +#ifdef WINRT MAKE_WRL_REF(_AsyncAction) vds_enumTask; #endif std::vector vds_Devices; @@ -715,7 +715,7 @@ public: bool setupDevice(int deviceID, unsigned int w, unsigned int h, unsigned int idealFramerate = 30); // Checking of recivig of new frame from video device with deviceID bool isFrameNew(int deviceID); -#ifdef HAVE_WINRT +#ifdef WINRT void waitForDevice(int deviceID); #endif // Writing of Raw Data pixels from video device with deviceID with correction of RedAndBlue flipping flipRedAndBlue and vertical flipping flipImage @@ -1237,7 +1237,7 @@ ImageGrabber::~ImageGrabber(void) DebugPrintOut(L"IMAGEGRABBER VIDEODEVICE %i: Destroying instance of the ImageGrabber class\n", ig_DeviceID); } -#ifdef HAVE_WINRT +#ifdef WINRT ImageGrabberWinRT::ImageGrabberWinRT(bool synchronous): ImageGrabberCallback(synchronous), @@ -1899,7 +1899,7 @@ Media_Foundation::~Media_Foundation(void) bool Media_Foundation::buildListOfDevices() { HRESULT hr = S_OK; -#ifdef HAVE_WINRT +#ifdef WINRT videoDevices *vDs = &videoDevices::getInstance(); hr = vDs->initDevices(WRL_ENUM_GET(_DeviceClass, DeviceClass, VideoCapture)); #else @@ -1987,7 +1987,7 @@ unsigned char * RawImage::getpPixels() videoDevice::videoDevice(void): vd_IsSetuped(false), vd_LockOut(OpenLock), vd_pFriendlyName(NULL), vd_Width(0), vd_Height(0), vd_FrameRate(0), vd_pSource(NULL), vd_pImGrTh(NULL), vd_func(NULL), vd_userData(NULL) { -#ifdef HAVE_WINRT +#ifdef WINRT vd_pMedCap = nullptr; vd_cookie.value = 0; vd_pImGr = NULL; @@ -2075,7 +2075,7 @@ CamParametrs videoDevice::getParametrs() return out; } -#ifdef HAVE_WINRT +#ifdef WINRT long videoDevice::resetDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice) #else long videoDevice::resetDevice(IMFActivate *pActivate) @@ -2086,7 +2086,7 @@ long videoDevice::resetDevice(IMFActivate *pActivate) if(vd_pFriendlyName) CoTaskMemFree(vd_pFriendlyName); vd_pFriendlyName = NULL; -#ifdef HAVE_WINRT +#ifdef WINRT if (pDevice) { ACTIVATE_OBJ(RuntimeClass_Windows_Media_Capture_MediaCapture, _MediaCapture, pIMedCap, hr) @@ -2157,7 +2157,7 @@ long videoDevice::resetDevice(IMFActivate *pActivate) return hr; } -#ifdef HAVE_WINRT +#ifdef WINRT long videoDevice::readInfoOfDevice(MAKE_WRL_REF(_IDeviceInformation) pDevice, unsigned int Num) { HRESULT hr = -1; @@ -2173,7 +2173,7 @@ long videoDevice::readInfoOfDevice(IMFActivate *pActivate, unsigned int Num) } #endif -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY long videoDevice::checkDevice(_DeviceClass devClass, DEFINE_TASK* pTask, MAKE_WRL_REF(_IDeviceInformation)* ppDevice) { @@ -2273,7 +2273,7 @@ long videoDevice::initDevice() { HRESULT hr = S_OK; CoInitialize(NULL); -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY Concurrency::critical_section::scoped_lock _LockHolder(vd_lock); MAKE_WRL_REF(_AsyncAction) pOldAction = vd_pAction; @@ -2381,7 +2381,7 @@ void videoDevice::closeDevice() { vd_IsSetuped = false; -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY if (DEREF_AGILE_WRL_OBJ(vd_pMedCap)) { MAKE_WRL_REF(_AsyncAction) action; @@ -2535,7 +2535,7 @@ void videoDevice::buildLibraryofTypes() } } -#ifdef HAVE_WINRT +#ifdef WINRT long videoDevice::setDeviceFormat(MAKE_WRL_REF(_MediaCapture) pSource, unsigned long dwFormatIndex, MAKE_WRL_REF(_AsyncAction)* pAction) { HRESULT hr; @@ -2596,7 +2596,7 @@ bool videoDevice::isDeviceSetup() RawImage * videoDevice::getRawImageOut() { if(!vd_IsSetuped) return NULL; -#ifdef HAVE_WINRT +#ifdef WINRT if(vd_pImGr) return vd_pImGr->getRawImage(); #endif if(vd_pImGrTh) @@ -2618,7 +2618,7 @@ bool videoDevice::isFrameNew() vd_LockOut = RawDataLock; //must already be closed -#ifdef HAVE_WINRT +#ifdef WINRT if (DEREF_AGILE_WRL_OBJ(vd_pMedCap)) { MAKE_WRL_REF(_AsyncAction) action; if (FAILED(ImageGrabberWinRT::CreateInstance(&vd_pImGr))) return false; @@ -2649,7 +2649,7 @@ bool videoDevice::isFrameNew() vd_pImGrTh->start(); return true; } -#ifdef HAVE_WINRT +#ifdef WINRT if(vd_pImGr) return vd_pImGr->getRawImage()->isNew(); #endif @@ -2678,7 +2678,7 @@ bool videoDevice::setupDevice(unsigned int id) HRESULT hr = initDevice(); if(SUCCEEDED(hr)) { -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY Concurrency::critical_section::scoped_lock _LockHolder(vd_lock); MAKE_WRL_REF(_AsyncAction) pOldAction = vd_pAction; @@ -2692,7 +2692,7 @@ bool videoDevice::setupDevice(unsigned int id) vd_Height = vd_CurrentFormats[id].height; vd_FrameRate = vd_CurrentFormats[id].MF_MT_FRAME_RATE_NUMERATOR / vd_CurrentFormats[id].MF_MT_FRAME_RATE_DENOMINATOR; -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY if (DEREF_AGILE_WRL_OBJ(vd_pMedCap)) { DEFINE_TASK _task; @@ -2710,7 +2710,7 @@ bool videoDevice::setupDevice(unsigned int id) if(vd_IsSetuped) DebugPrintOut(L"\n\nVIDEODEVICE %i: Device is setuped \n", vd_CurrentNumber); vd_PrevParametrs = getParametrs(); -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY END_CREATE_ASYNC(hr)); #endif @@ -2749,7 +2749,7 @@ wchar_t *videoDevice::getName() videoDevice::~videoDevice(void) { closeDevice(); -#ifdef HAVE_WINRT +#ifdef WINRT RELEASE_WRL(vd_pMedCap) #endif SafeRelease(&vd_pSource); @@ -2757,7 +2757,7 @@ videoDevice::~videoDevice(void) CoTaskMemFree(vd_pFriendlyName); } -#ifdef HAVE_WINRT +#ifdef WINRT HRESULT videoDevice::enumerateCaptureFormats(MAKE_WRL_REF(_MediaCapture) pSource) { HRESULT hr; @@ -2831,7 +2831,7 @@ done: videoDevices::videoDevices(void): count(0) { -#ifdef HAVE_WINRT +#ifdef WINRT vds_enumTask = nullptr; #endif } @@ -2862,7 +2862,7 @@ videoDevice * videoDevices::getDevice(unsigned int i) return vds_Devices[i]; } -#ifdef HAVE_WINRT +#ifdef WINRT long videoDevices::initDevices(_DeviceClass devClass) { HRESULT hr = S_OK; @@ -3196,7 +3196,7 @@ bool videoInput::isFrameNew(int deviceID) return false; } -#ifdef HAVE_WINRT +#ifdef WINRT void videoInput::waitForDevice(int deviceID) { if (deviceID < 0) @@ -3405,7 +3405,7 @@ unsigned int videoInput::listDevices(bool silent) if(accessToDevices) { videoDevices *VDS = &videoDevices::getInstance(); -#ifdef HAVE_WINRT +#ifdef WINRT VDS->waitInit(); #endif out = VDS->getCount(); @@ -3595,7 +3595,7 @@ protected: int index, width, height, fourcc; IplImage* frame; videoInput VI; -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY DEFINE_TASK openTask; Concurrency::critical_section lock; @@ -3643,7 +3643,7 @@ void CvCaptureCAM_MSMF::close() // Initialize camera input bool CvCaptureCAM_MSMF::open( int _index ) { -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY SAVE_CURRENT_CONTEXT(context); auto func = [_index, context, this](DEFINE_RET_VAL(bool)) -> DEFINE_RET_FORMAL(bool) { @@ -3656,14 +3656,14 @@ bool CvCaptureCAM_MSMF::open( int _index ) if (devices == 0) return false; try_index = try_index < 0 ? 0 : (try_index > devices-1 ? devices-1 : try_index); -#ifdef HAVE_WINRT +#ifdef WINRT HRESULT hr; #ifdef HAVE_CONCURRENCY BEGIN_CALL_IN_CONTEXT(hr, context, this, try_index) #endif #endif VI.setupDevice(try_index, 0, 0, 0); // With maximum frame size. -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY END_CALL_IN_CONTEXT_BASE VI.waitForDevice(try_index); @@ -3672,13 +3672,13 @@ bool CvCaptureCAM_MSMF::open( int _index ) #endif #endif if( !VI.isFrameNew(try_index) ) -#ifdef HAVE_WINRT +#ifdef WINRT hr = E_FAIL; #else return false; #endif index = try_index; -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef HAVE_CONCURRENCY END_CALL_IN_CONTEXT_BASE RET_VAL(true) diff --git a/modules/videoio/src/cap_msmf.hpp b/modules/videoio/src/cap_msmf.hpp index 352a491837..4fdf41fb31 100644 --- a/modules/videoio/src/cap_msmf.hpp +++ b/modules/videoio/src/cap_msmf.hpp @@ -1,4 +1,4 @@ -#ifdef HAVE_WINRT +#ifdef WINRT #define ICustomStreamSink StreamSink #ifndef __cplusplus_winrt @@ -380,7 +380,7 @@ MAKE_ENUM(MFSTREAMSINK_MARKER_TYPE) StreamSinkMarkerTypePairs[] = { }; MAKE_MAP(MFSTREAMSINK_MARKER_TYPE) StreamSinkMarkerTypeMap(StreamSinkMarkerTypePairs, StreamSinkMarkerTypePairs + sizeof(StreamSinkMarkerTypePairs) / sizeof(StreamSinkMarkerTypePairs[0])); -#ifdef HAVE_WINRT +#ifdef WINRT #ifdef __cplusplus_winrt #define _ContextCallback Concurrency::details::_ContextCallback @@ -1070,7 +1070,7 @@ protected: }; class StreamSink : -#ifdef HAVE_WINRT +#ifdef WINRT public Microsoft::WRL::RuntimeClass< Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::ClassicCom>, IMFStreamSink, @@ -1100,7 +1100,7 @@ public: if (riid == IID_IMarshal) { return MarshalQI(riid, ppv); } else { -#ifdef HAVE_WINRT +#ifdef WINRT hr = RuntimeClassT::QueryInterface(riid, ppv); #else if (riid == IID_IUnknown || riid == IID_IMFStreamSink) { @@ -1126,7 +1126,7 @@ public: return hr; } -#ifdef HAVE_WINRT +#ifdef WINRT STDMETHOD(RuntimeClassInitialize)() { return S_OK; } #else ULONG STDMETHODCALLTYPE AddRef() @@ -1177,7 +1177,7 @@ public: m_StartTime(0), m_fGetStartTimeFromSample(false), m_fWaitingForFirstSample(false), m_state(State_TypeNotSet), m_pParent(nullptr), m_imageWidthInPixels(0), m_imageHeightInPixels(0) { -#ifdef HAVE_WINRT +#ifdef WINRT m_token.value = 0; #else m_bConnected = false; @@ -1856,7 +1856,7 @@ public: return hr; } private: -#ifdef HAVE_WINRT +#ifdef WINRT EventRegistrationToken m_token; #else bool m_bConnected; @@ -1864,7 +1864,7 @@ private: bool m_IsShutdown; // Flag to indicate if Shutdown() method was called. CRITICAL_SECTION m_critSec; -#ifndef HAVE_WINRT +#ifndef WINRT long m_cRef; #endif IMFAttributes* m_pParent; @@ -2408,7 +2408,7 @@ protected: extern const __declspec(selectany) WCHAR RuntimeClass_CV_MediaSink[] = L"cv.MediaSink"; class MediaSink : -#ifdef HAVE_WINRT +#ifdef WINRT public Microsoft::WRL::RuntimeClass< Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassType::WinRtClassicComMix >, Microsoft::WRL::Implements, @@ -2420,7 +2420,7 @@ class MediaSink : public IMFMediaSink, public IMFClockStateSink, public CBaseAttributes<> #endif { -#ifdef HAVE_WINRT +#ifdef WINRT InspectableClass(RuntimeClass_CV_MediaSink, BaseTrust) public: #else @@ -2488,7 +2488,7 @@ public: return S_OK; } } -#ifdef HAVE_WINRT +#ifdef WINRT STDMETHODIMP SetProperties(ABI::Windows::Foundation::Collections::IPropertySet *pConfiguration) { HRESULT hr = S_OK; @@ -2828,7 +2828,7 @@ public: if (SUCCEEDED(hr)) { -#ifdef HAVE_WINRT +#ifdef WINRT pStream = Microsoft::WRL::Make(); if (pStream == nullptr) { hr = E_OUTOFMEMORY; @@ -2940,7 +2940,7 @@ public: { hr = m_streams.Remove(pos, nullptr); _ComPtr spCustomSink; -#ifdef HAVE_WINRT +#ifdef WINRT spCustomSink = static_cast(spStream.Get()); hr = S_OK; #else @@ -3164,7 +3164,7 @@ public: { _ComPtr spCustomSink; HRESULT hr; -#ifdef HAVE_WINRT +#ifdef WINRT spCustomSink = static_cast(pStream); #else hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); @@ -3187,7 +3187,7 @@ public: { _ComPtr spCustomSink; HRESULT hr; -#ifdef HAVE_WINRT +#ifdef WINRT spCustomSink = static_cast(pStream); #else hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); @@ -3207,7 +3207,7 @@ public: { _ComPtr spCustomSink; HRESULT hr; -#ifdef HAVE_WINRT +#ifdef WINRT spCustomSink = static_cast(pStream); #else hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); @@ -3317,7 +3317,7 @@ public: return hr; } private: -#ifndef HAVE_WINRT +#ifndef WINRT long m_cRef; #endif CRITICAL_SECTION m_critSec; @@ -3327,6 +3327,6 @@ private: LONGLONG m_llStartTime; }; -#ifdef HAVE_WINRT +#ifdef WINRT ActivatableClass(MediaSink); #endif diff --git a/platforms/winrt/build_all.bat b/platforms/winrt/build_all.bat new file mode 100644 index 0000000000..40b060e692 --- /dev/null +++ b/platforms/winrt/build_all.bat @@ -0,0 +1,86 @@ +@echo off + + +set FOUND_VC=0 + +if defined VS120COMNTOOLS ( + set VSTOOLS="%VS120COMNTOOLS%" + set VC_VER=120 + set FOUND_VC=1 +) + +set VSTOOLS=%VSTOOLS:"=% +set "VSTOOLS=%VSTOOLS:\=/%" + +set VSVARS="%VSTOOLS%vsvars32.bat" + +if not defined VSVARS ( + echo Can't find VC2013 installed! + goto ERROR +) + + +echo./* +echo. * Building OpenCV +echo. */ +echo. + + +call %VSVARS% + +if %FOUND_VC%==1 ( + call:DoMSBuild ..\..\bin\WP\8.1\x86\OpenCV.sln Debug + call:DoMSBuild ..\..\bin\WP\8.1\x86\INSTALL.vcxproj Debug + call:DoMSBuild ..\..\bin\WP\8.1\x86\OpenCV.sln Release + call:DoMSBuild ..\..\bin\WP\8.1\x86\INSTALL.vcxproj Release + + call:DoMSBuild ..\..\bin\WP\8.1\ARM\OpenCV.sln Debug + call:DoMSBuild ..\..\bin\WP\8.1\ARM\INSTALL.vcxproj Debug + call:DoMSBuild ..\..\bin\WP\8.1\ARM\OpenCV.sln Release + call:DoMSBuild ..\..\bin\WP\8.1\ARM\INSTALL.vcxproj Release + + call:DoMSBuild ..\..\bin\WS\8.1\x86\OpenCV.sln Debug + call:DoMSBuild ..\..\bin\WS\8.1\x86\INSTALL.vcxproj Debug + call:DoMSBuild ..\..\bin\WS\8.1\x86\OpenCV.sln Release + call:DoMSBuild ..\..\bin\WS\8.1\x86\INSTALL.vcxproj Release + + call:DoMSBuild ..\..\bin\WS\8.1\ARM\OpenCV.sln Debug + call:DoMSBuild ..\..\bin\WS\8.1\ARM\INSTALL.vcxproj Debug + call:DoMSBuild ..\..\bin\WS\8.1\ARM\OpenCV.sln Release + call:DoMSBuild ..\..\bin\WS\8.1\ARM\INSTALL.vcxproj Release + + call:DoMSBuild ..\..\bin\WP\8.0\x86\OpenCV.sln Debug + call:DoMSBuild ..\..\bin\WP\8.0\x86\INSTALL.vcxproj Debug + call:DoMSBuild ..\..\bin\WP\8.0\x86\OpenCV.sln Release + call:DoMSBuild ..\..\bin\WP\8.0\x86\INSTALL.vcxproj Release + + call:DoMSBuild ..\..\bin\WP\8.0\ARM\OpenCV.sln Debug + call:DoMSBuild ..\..\bin\WP\8.0\ARM\INSTALL.vcxproj Debug + call:DoMSBuild ..\..\bin\WP\8.0\ARM\OpenCV.sln Release + call:DoMSBuild ..\..\bin\WP\8.0\ARM\INSTALL.vcxproj Release + + call:DoMSBuild ..\..\bin\WS\8.0\x86\OpenCV.sln Debug + call:DoMSBuild ..\..\bin\WS\8.0\x86\INSTALL.vcxproj Debug + call:DoMSBuild ..\..\bin\WS\8.0\x86\OpenCV.sln Release + call:DoMSBuild ..\..\bin\WS\8.0\x86\INSTALL.vcxproj Release + + call:DoMSBuild ..\..\bin\WS\8.0\ARM\OpenCV.sln Debug + call:DoMSBuild ..\..\bin\WS\8.0\ARM\INSTALL.vcxproj Debug + call:DoMSBuild ..\..\bin\WS\8.0\ARM\OpenCV.sln Release + call:DoMSBuild ..\..\bin\WS\8.0\ARM\INSTALL.vcxproj Release +) + +echo.&goto:EOF + + +::-------------------------------------------------------- +::-- DoMSBuild +::-------------------------------------------------------- +:DoMSBuild +msbuild %~1 /p:Configuration="%~2" /m +@if errorlevel 1 goto :ERROR +goto:EOF + +:ERROR +pause +:EOF \ No newline at end of file diff --git a/platforms/winrt/readme.txt b/platforms/winrt/readme.txt new file mode 100644 index 0000000000..9f7d194797 --- /dev/null +++ b/platforms/winrt/readme.txt @@ -0,0 +1,102 @@ +Building OpenCV from Source, using CMake and Command Line +========================================================= + +Requirements +============ +CMake 3.1.0 or higher +Windows Phone/Store 8.1 Visual Studio 2013 +Windows Phone/Store 8.0 Visual Studio 2012 + +For example, to be able to build all Windows Phone and Windows Store projects install the following: + +Install Visual Studio 2013 Community Edition + http://go.microsoft.com/?linkid=9863608 + +Install Visual Studio Express 2012 for Windows Desktop + http://www.microsoft.com/en-us/download/details.aspx?id=34673 + + + +To create all Windows Phone (8.0, 8.1) and Windows Store (8.0, 8.1) Visual Studio projects +========================================================================================== +cd opencv/platforms/winrt +setup_winrt.bat "WP,WS" "8.0,8.1" "x86,ARM" + +If everything's fine, a few minutes later you will get the following output in the opencv/bin directory: + +bin + WP + 8.0 + ARM + x86 + 8.1 + ARM + x86 + WS + 8.0 + ARM + x86 + 8.1 + ARM + x86 + +Build the OpenCV.sln for the particular platform you are targeting. Due to the current limitations of CMake, separate x86/x64/ARM projects must be generated for each platform. + +You can also target a single specific configuration + setup_winrt.bat "WP" "8.1" "x86" + +Or a subset of configurations + setup_winrt.bat "WP,WS" "8.1" "x86" + +To display the command line options for setup_winrt.bat + setup_winrt.bat -h + +Note that x64 CMake generation support is as follows: +------------------------------ +Platform\Version | 8.0 | 8.1 | +-----------------|-----|-----| +Windows Phone | No | No | +Windows Store | Yes | Yes | + +Note: setup_winrt.bat calls the unsigned PowerShell script with the -ExecutionPolicy Unrestricted option. + + +CMake command line options for Windows Phone and Store +====================================================== + +cmake [options] + +Windows Phone 8.1 x86 +cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.1 + +Windows Phone 8.1 ARM +cmake -G "Visual Studio 12 2013 ARM" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.1 + +Windows Store 8.1 x86 +cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1 + +Windows Store 8.1 ARM +cmake -G "Visual Studio 12 2013 ARM" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1 + +Note: For Windows 8.0 Phone and Store you can specify either Visual Studio 11 2012 or Visual Studio 12 2013 as the generator + +Windows Phone 8.0 x86 +cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.0 + +Windows Phone 8.0 ARM +cmake -G "Visual Studio 12 2013 ARM" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.0 + +Windows Store 8.0 x86 +cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.0 + +Windows Store 8.0 ARM +cmake -G "Visual Studio 12 2013 ARM" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.0 + +Example +====================================================== + +To generate Windows Phone 8.1 x86 project files in the opencv/bin dir + +mkdir bin +cd bin +cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.1 ../ \ No newline at end of file diff --git a/platforms/winrt/setup_winrt.bat b/platforms/winrt/setup_winrt.bat new file mode 100644 index 0000000000..3268bcf602 --- /dev/null +++ b/platforms/winrt/setup_winrt.bat @@ -0,0 +1,2 @@ +@echo off +Powershell.exe -ExecutionPolicy Unrestricted -File setup_winrt.ps1 %* diff --git a/platforms/winrt/setup_winrt.ps1 b/platforms/winrt/setup_winrt.ps1 new file mode 100644 index 0000000000..b7ef93dcd0 --- /dev/null +++ b/platforms/winrt/setup_winrt.ps1 @@ -0,0 +1,331 @@ +<# +Copyright © Microsoft Open Technologies, Inc. +All Rights Reserved +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. + +You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, +FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache 2 License for the specific language governing permissions and limitations under the License. +#> + +[CmdletBinding()] +Param( + [parameter(Mandatory=$False)] + [switch] + $HELP, + + [parameter(Mandatory=$False)] + [switch] + $BUILD, + + [parameter(Mandatory=$False)] + [Array] + [ValidateNotNull()] + $PLATFORMS_IN = "WP", + + [parameter(Mandatory=$False)] + [Array] + [ValidateNotNull()] + $VERSIONS_IN = "8.1", + + [parameter(Mandatory=$False)] + [Array] + [ValidateNotNull()] + $ARCHITECTURES_IN = "x86", + + [parameter(Mandatory=$False)] + [String] + [ValidateNotNull()] + [ValidateSet("Visual Studio 12 2013","Visual Studio 11 2012")] + $GENERATOR = "Visual Studio 12 2013", + + [parameter(Mandatory=$False)] + [String] + $INSTALL +) + + +Function L() { + Param( + [parameter(Mandatory=$true)] + [String] + [ValidateNotNull()] + $str + ) + + Write-Host "INFO> $str" +} + +Function D() { + Param( + [parameter(Mandatory=$true)] + [String] + [ValidateNotNull()] + $str + ) + + # Use this trigger to toggle debug output + [bool]$debug = $true + + if ($debug) { + Write-Host "DEBUG> $str" + } +} + +function Get-Batchfile ($file) { + $cmd = "`"$file`" & set" + cmd /c $cmd | Foreach-Object { + $p, $v = $_.split('=') + Set-Item -path env:$p -value $v + } +} + +# Enables access to Visual Studio variables via "vsvars32.bat" +function Set-VS12() +{ + Try { + $vs12comntools = (Get-ChildItem env:VS120COMNTOOLS).Value + $batchFile = [System.IO.Path]::Combine($vs12comntools, "vsvars32.bat") + Get-Batchfile $BatchFile + [System.Console]::Title = "Visual Studio 2010 Windows PowerShell" + } Catch { + $ErrorMessage = $_.Exception.Message + L "Error: $ErrorMessage" + return $false + } + return $true +} + +# Executes msbuild to build or install projects +# Throws Exception on error +function Call-MSBuild($path, $config) +{ + $command = "msbuild $path /p:Configuration='$config' /m" + L "Executing: $($command)" + msbuild $path /p:Configuration="$config" /m + + if(-Not $?) { + Throw "Failure executing command: $($command)" + } + + return $true +} + +Function Execute() { + If ($HELP.IsPresent) { + ShowHelp + } + + # Validating arguments. + # This type of validation (rather than using ValidateSet()) is required to make .bat wrapper work + + D "Input Platforms: $PLATFORMS_IN" + $platforms = New-Object System.Collections.ArrayList + $PLATFORMS_IN.Split("," ,[System.StringSplitOptions]::RemoveEmptyEntries) | ForEach { + $_ = $_.Trim() + if ("WP","WS" -Contains $_) { + [void]$platforms.Add($_) + D "$_ is valid" + } else { + Throw "$($_) is not valid! Please use WP, WS" + } + } + D "Processed Platforms: $platforms" + + D "Input Versions: $VERSIONS_IN" + $versions = New-Object System.Collections.ArrayList + $VERSIONS_IN.Split("," ,[System.StringSplitOptions]::RemoveEmptyEntries) | ForEach { + $_ = $_.Trim() + if ("8.0","8.1" -Contains $_) { + [void]$versions.Add($_) + D "$_ is valid" + } else { + Throw "$($_) is not valid! Please use 8.0, 8.1" + } + } + D "Processed Versions: $versions" + + D "Input Architectures: $ARCHITECTURES_IN" + $architectures = New-Object System.Collections.ArrayList + $ARCHITECTURES_IN.Split("," ,[System.StringSplitOptions]::RemoveEmptyEntries) | ForEach { + $_ = $_.Trim() + if ("x86","x64","ARM" -Contains $_) { + $architectures.Add($_) > $null + D "$_ is valid" + } else { + Throw "$($_) is not valid! Please use x86, x64, ARM" + } + } + D "Processed Architectures: $architectures" + + # Assuming we are in '/platforms/winrt' we should move up to sources root directory + Push-Location ../../ + + $SRC = Get-Location + + $def_architectures = @{ + "x86" = ""; + "x64" = " Win64" + "arm" = " ARM" + } + + # Setting up Visual Studio variables to enable build + $shouldBuid = $false + If ($BUILD.IsPresent) { + $shouldBuild = Set-VS12 + } + + foreach($plat in $platforms) { + # Set proper platform name. + $platName = "" + Switch ($plat) { + "WP" { $platName = "WindowsPhone" } + "WS" { $platName = "WindowsStore" } + } + + foreach($vers in $versions) { + + foreach($arch in $architectures) { + + # Set proper architecture. For MSVS this is done by selecting proper generator + $genName = $GENERATOR + Switch ($arch) { + "ARM" { $genName = $GENERATOR + $def_architectures['arm'] } + "x64" { $genName = $GENERATOR + $def_architectures['x64'] } + } + + # Constructing path to the install binaries + # Creating these binaries will be done by building CMake-generated INSTALL project from Visual Studio + $installPath = "$SRC\bin\install\$plat\$vers\$arch" + if ($INSTALL) { + # Do not add architrecture to the path since it will be added by OCV CMake logic + $installPath = "$SRC\$INSTALL\$plat\$vers" + } + + $path = "$SRC\bin\$plat\$vers\$arch" + + L "-----------------------------------------------" + L "Target:" + L " Directory: $path" + L " Platform: $platName" + L " Version: $vers" + L " Architecture: $arch" + L " Generator: $genName" + L " Install Directory: $installPath" + + # Delete target directory if exists to ensure that CMake cache is cleared out. + If (Test-Path $path) { + Remove-Item -Recurse -Force $path + } + + # Validate if required directory exists, create if it doesn't + New-Item -ItemType Directory -Force -Path $path + + # Change location to the respective subdirectory + Push-Location -Path $path + + L "Generating project:" + L "cmake -G $genName -DCMAKE_SYSTEM_NAME:String=$platName -DCMAKE_SYSTEM_VERSION:String=$vers -DCMAKE_VS_EFFECTIVE_PLATFORMS:String=$arch -DCMAKE_INSTALL_PREFIX:PATH=$installPath $SRC" + cmake -G $genName -DCMAKE_SYSTEM_NAME:String=$platName -DCMAKE_SYSTEM_VERSION:String=$vers -DCMAKE_VS_EFFECTIVE_PLATFORMS:String=$arch -DCMAKE_INSTALL_PREFIX:PATH=$installPath $SRC + L "-----------------------------------------------" + + # REFERENCE: + # Executed from '$SRC/bin' folder. + # Targeting x86 WindowsPhone 8.1. + # cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME:String=WindowsPhone -DCMAKE_SYSTEM_VERSION:String=8.1 .. + + + # Building and installing project + Try { + If ($shouldBuild) { + L "Building and installing project:" + + Call-MSBuild "OpenCV.sln" "Debug" + Call-MSBuild "INSTALL.vcxproj" "Debug" + + Call-MSBuild "OpenCV.sln" "Release" + Call-MSBuild "INSTALL.vcxproj" "Release" + } + } Catch { + $ErrorMessage = $_.Exception.Message + L "Error: $ErrorMessage" + + # Exiting at this point will leave command line pointing at the erroneous configuration directory + exit + } + + # Return back to Sources folder + Pop-Location + } + } + } + + # Return back to Script folder + Pop-Location +} + +Function ShowHelp() { + Write-Host "Configures OpenCV and generates projects for specified verion of Visual Studio/platforms/architectures." + Write-Host "Must be executed from the sources folder containing main CMakeLists configuration." + Write-Host "Parameter keys can be shortened down to a single symbol (e.g. '-a') and are not case sensitive." + Write-Host "Proper parameter sequencing is required when omitting keys." + Write-Host "Generates the following folder structure, depending on the supplied parameters: " + Write-Host " bin/ " + Write-Host " | " + Write-Host " |-WP " + Write-Host " | ... " + Write-Host " |-WinRT " + Write-Host " | |-8.0 " + Write-Host " | |-8.1 " + Write-Host " | | |-x86 " + Write-Host " | | |-x64 " + Write-Host " | | |-ARM " + Write-Host " " + Write-Host " USAGE: " + Write-Host " Calling:" + Write-Host " PS> setup_winrt.ps1 [params]" + Write-Host " cmd> setup_winrt.bat [params]" + Write-Host " cmd> PowerShell.exe -ExecutionPolicy Unrestricted -File setup_winrt.ps1 [params]" + Write-Host " Parameters:" + Write-Host " setup_winrt [options] [platform] [version] [architecture] [generator] [install-path]" + Write-Host " setup_winrt -b 'WP' 'x86,ARM' " + Write-Host " setup_winrt -architecture x86 -platform WP " + Write-Host " setup_winrt -arc x86 -plat 'WP,WS' " + Write-Host " setup_winrt -a x86 -g 'Visual Studio 11 2012' -pl WP " + Write-Host " WHERE: " + Write-Host " options - Options to call " + Write-Host " -h: diplays command line help " + Write-Host " -b: builds BUILD_ALL and INSTALL projects for each generated configuration in both Debug and Release modes." + Write-Host " platform - Array of target platforms. " + Write-Host " Default: WP " + Write-Host " Example: 'WS,WP' " + Write-Host " Options: WP, WS ('WindowsPhone', 'WindowsStore'). " + Write-Host " Note that you'll need to use quotes to specify more than one platform. " + Write-Host " version - Array of platform versions. " + Write-Host " Default: 8.1 " + Write-Host " Example: '8.0,8.1' " + Write-Host " Options: 8.0, 8.1. Available options may be limited depending on your local setup (e.g. SDK availability). " + Write-Host " Note that you'll need to use quotes to specify more than one version. " + Write-Host " architecture - Array of target architectures to build for. " + Write-Host " Default: x86 " + Write-Host " Example: 'ARM,x64' " + Write-Host " Options: x86, ARM, x64. Available options may be limited depending on your local setup. " + Write-Host " Note that you'll need to use quotes to specify more than one architecture. " + Write-Host " generator - Visual Studio instance used to generate the projects. " + Write-Host " Default: Visual Studio 12 2013 " + Write-Host " Example: 'Visual Studio 11 2012' " + Write-Host " Use 'cmake --help' to find all available option on your machine. " + Write-Host " install-path - Path to install binaries (relative to the sources directory). " + Write-Host " Default: \bin\install\\\ " + Write-Host " Example: '../install' " + + Exit +} + +Execute \ No newline at end of file diff --git a/samples/winrt/.gitignore b/samples/winrt/.gitignore new file mode 100644 index 0000000000..d4b2f0f455 --- /dev/null +++ b/samples/winrt/.gitignore @@ -0,0 +1,87 @@ +# Ignore thumbnails created by windows +Thumbs.db + +#ignore winrt copies of opencv files +opencl_kernels.cpp +opencl_kernels.hpp + +# Ignore files build by Visual Studio +*.obj +*.exe +*.pdb +*.aps +*.vcproj.*.user +*.vcxproj.user +*.vspscc +*_i.c +*.i +*.icf +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +*.winmd +[Bb]in +[Dd]ebug*/ +*.sbr +*.sdf +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* +ipch/ +*.opensdf +Generated Files +AppPackages +SubmissionInfo +*.hps + +# Ignore files build by ndk and eclipse +libs/ +bin/ +obj/ +gen/ +local.properties + +# Ignore python compiled files +*.pyc + +# Ignore files build by airplay and marmalade +build_*_xcode/ +build_*_vc10/ + +# Ignore files built by xcode +*.mode*v* +*.pbxuser +*.xcbkptlist +*.xcscheme +*.xcworkspacedata +*.xcuserstate +xcschememanagement.plist +build/ +.DS_Store +._.* +xcuserdata/ +DerivedData/ +*.xccheckout + +# Ignore files built by bada +.Simulator-Debug/ +.Target-Debug/ +.Target-Release/ + +# Ignore files built by blackberry +Simulator/ +Device-Debug/ +Device-Release/ + +# Ignore vim swaps +*.swp + +# CTags +tags diff --git a/samples/winrt/ImageManipulations/MediaCapture.sln b/samples/winrt/ImageManipulations/MediaCapture.sln index e1f9aa3859..f82f20396e 100644 --- a/samples/winrt/ImageManipulations/MediaCapture.sln +++ b/samples/winrt/ImageManipulations/MediaCapture.sln @@ -1,9 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 11 Express for Windows 8 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MediaCapture", "MediaCapture.vcxproj", "{C5B886A7-8300-46FF-B533-9613DE2AF637}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GrayscaleTransform", "MediaExtensions\OcvTransform\OcvTransform.vcxproj", "{BA69218F-DA5C-4D14-A78D-21A9E4DEC669}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OcvTransform", "MediaExtensions\OcvTransform\OcvTransform.vcxproj", "{BA69218F-DA5C-4D14-A78D-21A9E4DEC669}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,18 +17,6 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|ARM.ActiveCfg = Debug|ARM - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|ARM.Build.0 = Debug|ARM - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|Win32.ActiveCfg = Debug|Win32 - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|Win32.Build.0 = Debug|Win32 - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|x64.ActiveCfg = Debug|x64 - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|x64.Build.0 = Debug|x64 - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|ARM.ActiveCfg = Release|ARM - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|ARM.Build.0 = Release|ARM - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|Win32.ActiveCfg = Release|Win32 - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|Win32.Build.0 = Release|Win32 - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|x64.ActiveCfg = Release|x64 - {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|x64.Build.0 = Release|x64 {C5B886A7-8300-46FF-B533-9613DE2AF637}.Debug|ARM.ActiveCfg = Debug|ARM {C5B886A7-8300-46FF-B533-9613DE2AF637}.Debug|ARM.Build.0 = Debug|ARM {C5B886A7-8300-46FF-B533-9613DE2AF637}.Debug|ARM.Deploy.0 = Debug|ARM @@ -45,6 +35,18 @@ Global {C5B886A7-8300-46FF-B533-9613DE2AF637}.Release|x64.ActiveCfg = Release|x64 {C5B886A7-8300-46FF-B533-9613DE2AF637}.Release|x64.Build.0 = Release|x64 {C5B886A7-8300-46FF-B533-9613DE2AF637}.Release|x64.Deploy.0 = Release|x64 + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|ARM.ActiveCfg = Debug|ARM + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|ARM.Build.0 = Debug|ARM + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|Win32.ActiveCfg = Debug|Win32 + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|Win32.Build.0 = Debug|Win32 + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|x64.ActiveCfg = Debug|x64 + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Debug|x64.Build.0 = Debug|x64 + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|ARM.ActiveCfg = Release|ARM + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|ARM.Build.0 = Release|ARM + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|Win32.ActiveCfg = Release|Win32 + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|Win32.Build.0 = Release|Win32 + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|x64.ActiveCfg = Release|x64 + {BA69218F-DA5C-4D14-A78D-21A9E4DEC669}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/samples/winrt/ImageManipulations/MediaCapture.vcxproj b/samples/winrt/ImageManipulations/MediaCapture.vcxproj index a0f8c84f9b..ae243ce7d7 100644 --- a/samples/winrt/ImageManipulations/MediaCapture.vcxproj +++ b/samples/winrt/ImageManipulations/MediaCapture.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -30,71 +30,96 @@ {C5B886A7-8300-46FF-B533-9613DE2AF637} SDKSample en-US - $(VCTargetsPath11) - 11.0 + 12.0 true MediaCapture + Windows Store + 8.1 Application true - v110 + v120 Application true - v110 + v120 Application true - v110 + v120 Application false true - v110 + v120 Application false true - v110 + v120 Application false true - v110 + v120 + + + + + + - + + True + x86 + 76D64E4F88C9B7D47ACA757CDFD15D6F3AD81D92 + MediaCapture_TemporaryKey.pfx + + + $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86); + pch.h + $(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + $(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + $(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + $(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + $(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + $(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + + %(AdditionalLibraryDirectories) + %(AdditionalDependencies) + @@ -159,152 +184,17 @@ - + + + true + {ba69218f-da5c-4d14-a78d-21a9e4dec669} - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - true - true - true - true - true - true - - - + \ No newline at end of file diff --git a/samples/winrt/ImageManipulations/MediaCapture.vcxproj.filters b/samples/winrt/ImageManipulations/MediaCapture.vcxproj.filters new file mode 100644 index 0000000000..fd07700520 --- /dev/null +++ b/samples/winrt/ImageManipulations/MediaCapture.vcxproj.filters @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + + + + + + + {392352d8-f913-4741-82cf-d8075bb6f022} + + + + + + \ No newline at end of file diff --git a/samples/winrt/ImageManipulations/MediaCapture_TemporaryKey.pfx b/samples/winrt/ImageManipulations/MediaCapture_TemporaryKey.pfx new file mode 100644 index 0000000000..0f4f0d9e3d Binary files /dev/null and b/samples/winrt/ImageManipulations/MediaCapture_TemporaryKey.pfx differ diff --git a/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvImageManipulations.idl b/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvImageManipulations.idl index 37235a092d..1bec5d0dc8 100644 --- a/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvImageManipulations.idl +++ b/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvImageManipulations.idl @@ -7,5 +7,6 @@ namespace OcvTransform [version(NTDDI_WIN8)] runtimeclass OcvImageManipulations { + interface Windows.Media.IMediaExtension; } } diff --git a/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvTransform.cpp b/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvTransform.cpp index 538f353f5e..438b2c6d13 100644 --- a/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvTransform.cpp +++ b/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvTransform.cpp @@ -8,8 +8,11 @@ #include "OcvTransform.h" #include "bufferlock.h" -#include "opencv2\core\core.hpp" -#include "opencv2\imgproc\imgproc.hpp" +#include +#include +#include + + using namespace Microsoft::WRL; diff --git a/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvTransform.vcxproj b/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvTransform.vcxproj index 54c0ce40ab..f335daf585 100644 --- a/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvTransform.vcxproj +++ b/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/OcvTransform.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -27,47 +27,48 @@ - $(VCTargetsPath11) {BA69218F-DA5C-4D14-A78D-21A9E4DEC669} Win32Proj OcvTransform OcvTransform - 11.0 + 12.0 true + Windows Store + 8.1 DynamicLibrary true - v110 + v120 DynamicLibrary true - v110 + v120 DynamicLibrary true - v110 + v120 DynamicLibrary false true - v110 + v120 DynamicLibrary false true - v110 + v120 DynamicLibrary false true - v110 + v120 @@ -75,27 +76,34 @@ + + + + + + false $(Configuration)\$(MSBuildProjectName)\ + $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86) false @@ -123,14 +131,14 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) false - $(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common + %(AdditionalIncludeDirectories) Console - runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib;opencv_core245.lib;opencv_imgproc245.lib + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) false OcvTransform.def - $(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories) mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(ProjectDir)$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial @@ -147,14 +155,14 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) false - $(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common + %(AdditionalIncludeDirectories) Console - runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) false OcvTransform.def - $(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories) mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial @@ -171,14 +179,14 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) false - $(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common + %(AdditionalIncludeDirectories) Console - runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) false OcvTransform.def - $(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories) mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial @@ -195,14 +203,14 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) false - $(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common + %(AdditionalIncludeDirectories) Console - runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) false OcvTransform.def - $(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories) mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(ProjectDir)$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial @@ -219,14 +227,14 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) false - $(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common + %(AdditionalIncludeDirectories) Console - runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) false OcvTransform.def - $(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories) mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial @@ -243,14 +251,14 @@ $(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories) false - $(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common + %(AdditionalIncludeDirectories) Console - runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib + %(AdditionalDependencies) + %(AdditionalLibraryDirectories) false OcvTransform.def - $(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories) mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial @@ -316,4 +324,4 @@ - + \ No newline at end of file diff --git a/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/opencv.props b/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/opencv.props new file mode 100644 index 0000000000..63acf9e60a --- /dev/null +++ b/samples/winrt/ImageManipulations/MediaExtensions/OcvTransform/opencv.props @@ -0,0 +1,31 @@ + + + + + $(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\bin\ + $(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\lib\ + $(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\include\ + + d + + + + + + true + + + true + + + + + $(OpenCV_Include);$(ProjectDir)\..\Common;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + + + + opencv_core300$(DebugSuffix).lib;opencv_imgproc300$(DebugSuffix).lib;runtimeobject.lib;mf.lib;mfuuid.lib;mfplat.lib;%(AdditionalDependencies) + $(OpenCV_Lib);%(AdditionalLibraryDirectories); + + + \ No newline at end of file diff --git a/samples/winrt/ImageManipulations/Package.appxmanifest b/samples/winrt/ImageManipulations/Package.appxmanifest index b66e01465e..96b6455c4a 100644 --- a/samples/winrt/ImageManipulations/Package.appxmanifest +++ b/samples/winrt/ImageManipulations/Package.appxmanifest @@ -1,24 +1,28 @@  - - + + MediaCapture CPP sample Microsoft Corporation - Assets\storeLogo-sdk.png + Assets\windows-sdk.png - 6.2.1 - 6.2.1 + 6.3 + 6.3 - - - - + + + + + + + + @@ -33,4 +37,4 @@ - + \ No newline at end of file diff --git a/samples/winrt/ImageManipulations/assets/StoreLogo.png b/samples/winrt/ImageManipulations/assets/StoreLogo.png new file mode 100644 index 0000000000..af64bf00ad Binary files /dev/null and b/samples/winrt/ImageManipulations/assets/StoreLogo.png differ diff --git a/samples/winrt/ImageManipulations/assets/windows-sdk.scale-100.png b/samples/winrt/ImageManipulations/assets/windows-sdk.scale-100.png new file mode 100644 index 0000000000..af64bf00ad Binary files /dev/null and b/samples/winrt/ImageManipulations/assets/windows-sdk.scale-100.png differ diff --git a/samples/winrt/ImageManipulations/opencv.props b/samples/winrt/ImageManipulations/opencv.props new file mode 100644 index 0000000000..5ad46b43df --- /dev/null +++ b/samples/winrt/ImageManipulations/opencv.props @@ -0,0 +1,31 @@ + + + + + $(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\bin\ + $(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\lib\ + $(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\include\ + + d + + + + + + true + + + true + + + + + $(OpenCV_Include);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories); + + + + opencv_core300$(DebugSuffix).lib;opencv_imgproc300$(DebugSuffix).lib;%(AdditionalDependencies) + $(OpenCV_Lib);%(AdditionalLibraryDirectories); + + + \ No newline at end of file diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln b/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln index 11bf904bc1..c93d53e9d1 100644 --- a/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OcvImageProcessing", "OcvImageProcessing\OcvImageProcessing.vcxproj", "{A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}" EndProject Global diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.cpp b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.cpp index 6d5ac04bda..2e91eb156b 100644 --- a/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.cpp +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.cpp @@ -9,6 +9,8 @@ #include #include #include +#include + using namespace OcvImageProcessing; using namespace Microsoft::WRL; @@ -129,7 +131,7 @@ cv::Mat OcvImageProcessing::MainPage::ApplyFindFeaturesFilter(const cv::Mat& ima { cv::Mat result; cv::Mat intermediateMat; - cv::Ptr detector = cv::FastFeatureDetector::create(50); + cv::Ptr detector = cv::FastFeatureDetector::create(50); std::vector features; image.copyTo(result); diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj index 1d862b71e1..888dfca056 100644 --- a/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -30,115 +30,89 @@ {a5555ea2-f9e8-4078-90f5-d428f2c0d6d1} OcvImageProcessing en-US - 11.0 + 12.0 true + Windows Store + 8.1 Application true - v110 + v120 Application true - v110 + v120 Application true - v110 + v120 Application false true - v110 + v120 Application false true - v110 + v120 Application false true - v110 + v120 + + + + + + OcvImageProcessing_TemporaryKey.pfx - True + False + x86 - + /bigobj %(AdditionalOptions) 4453 - - - - - /bigobj %(AdditionalOptions) - 4453 - - - - - /bigobj %(AdditionalOptions) - 4453 - $(OPENCV_DIR)\include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) - $(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories) - opencv_core247d.lib;opencv_imgproc247d.lib;opencv_features2d247d.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories) + %(AdditionalDependencies) - - - /bigobj %(AdditionalOptions) - 4453 - $(OPENCV_DIR)\include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - - - $(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories) - opencv_core247.lib;opencv_imgproc247.lib;opencv_features2d247.lib;%(AdditionalDependencies) - - - - - /bigobj %(AdditionalOptions) - 4453 - - - - - /bigobj %(AdditionalOptions) - 4453 - - @@ -163,105 +137,6 @@ Designer - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - - - true - diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj.filters b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj.filters index 607c601c18..1546822339 100644 --- a/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj.filters +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj.filters @@ -41,39 +41,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing_TemporaryKey.pfx b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing_TemporaryKey.pfx new file mode 100644 index 0000000000..b7e4c30f27 Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing_TemporaryKey.pfx differ diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Package.appxmanifest b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Package.appxmanifest index 40f61cf768..19ed89b27b 100644 --- a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Package.appxmanifest +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Package.appxmanifest @@ -1,24 +1,28 @@  - - + + OcvImageProcessing asmorkalov Assets\StoreLogo.png - 6.2.1 - 6.2.1 + 6.3 + 6.3 - - - - + + + + + + + + \ No newline at end of file diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/opencv.props b/samples/winrt/OcvImageProcessing/OcvImageProcessing/opencv.props new file mode 100644 index 0000000000..40eaffd1f0 --- /dev/null +++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/opencv.props @@ -0,0 +1,40 @@ + + + + + $(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\bin\ + $(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\lib\ + $(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\include\ + + d + + + + + + true + + + true + + + true + + + true + + + true + + + + + $(OpenCV_Include);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories); + + + + opencv_core300$(DebugSuffix).lib;opencv_imgproc300$(DebugSuffix).lib;opencv_features2d300$(DebugSuffix).lib;opencv_flann300$(DebugSuffix).lib;opencv_ml300$(DebugSuffix).lib;%(AdditionalDependencies) + $(OpenCV_Lib);%(AdditionalLibraryDirectories); + + + \ No newline at end of file diff --git a/samples/winrt/readme.txt b/samples/winrt/readme.txt new file mode 100644 index 0000000000..53c4d7ca28 --- /dev/null +++ b/samples/winrt/readme.txt @@ -0,0 +1,6 @@ +Building OpenCV WinRT Samples +============================= + +Samples are created to run against x86 architecture OpenCV binaries. + +Please follow the instructions in "platforms/winrt/readme.txt" to generate and build OpenCV for WinRT. \ No newline at end of file diff --git a/samples/winrt_universal/.gitignore b/samples/winrt_universal/.gitignore new file mode 100644 index 0000000000..d4b2f0f455 --- /dev/null +++ b/samples/winrt_universal/.gitignore @@ -0,0 +1,87 @@ +# Ignore thumbnails created by windows +Thumbs.db + +#ignore winrt copies of opencv files +opencl_kernels.cpp +opencl_kernels.hpp + +# Ignore files build by Visual Studio +*.obj +*.exe +*.pdb +*.aps +*.vcproj.*.user +*.vcxproj.user +*.vspscc +*_i.c +*.i +*.icf +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +*.winmd +[Bb]in +[Dd]ebug*/ +*.sbr +*.sdf +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* +ipch/ +*.opensdf +Generated Files +AppPackages +SubmissionInfo +*.hps + +# Ignore files build by ndk and eclipse +libs/ +bin/ +obj/ +gen/ +local.properties + +# Ignore python compiled files +*.pyc + +# Ignore files build by airplay and marmalade +build_*_xcode/ +build_*_vc10/ + +# Ignore files built by xcode +*.mode*v* +*.pbxuser +*.xcbkptlist +*.xcscheme +*.xcworkspacedata +*.xcuserstate +xcschememanagement.plist +build/ +.DS_Store +._.* +xcuserdata/ +DerivedData/ +*.xccheckout + +# Ignore files built by bada +.Simulator-Debug/ +.Target-Debug/ +.Target-Release/ + +# Ignore files built by blackberry +Simulator/ +Device-Debug/ +Device-Release/ + +# Ignore vim swaps +*.swp + +# CTags +tags diff --git a/samples/winrt_universal/PhoneTutorial/App.xaml b/samples/winrt_universal/PhoneTutorial/App.xaml new file mode 100644 index 0000000000..2f1febe3bd --- /dev/null +++ b/samples/winrt_universal/PhoneTutorial/App.xaml @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/samples/winrt_universal/PhoneTutorial/App.xaml.cpp b/samples/winrt_universal/PhoneTutorial/App.xaml.cpp new file mode 100644 index 0000000000..1e2ad733d7 --- /dev/null +++ b/samples/winrt_universal/PhoneTutorial/App.xaml.cpp @@ -0,0 +1,137 @@ +// +// App.xaml.cpp +// Implementation of the App class. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace PhoneTutorial; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Media::Animation; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkID=391641 + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used when the application is launched to open a specific file, to display +/// search results, and so forth. +/// +/// Details about the launch request and process. +void App::OnLaunched(LaunchActivatedEventArgs^ e) +{ +#if _DEBUG + if (IsDebuggerPresent()) + { + DebugSettings->EnableFrameRateCounter = true; + } +#endif + + auto rootFrame = dynamic_cast(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active. + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + // TODO: Change this value to a cache size that is appropriate for your application. + rootFrame->CacheSize = 1; + + if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete. + } + + // Place the frame in the current Window + Window::Current->Content = rootFrame; + } + + if (rootFrame->Content == nullptr) + { + // Removes the turnstile navigation for startup. + if (rootFrame->ContentTransitions != nullptr) + { + _transitions = ref new TransitionCollection(); + for (auto transition : rootFrame->ContentTransitions) + { + _transitions->Append(transition); + } + } + + rootFrame->ContentTransitions = nullptr; + _firstNavigatedToken = rootFrame->Navigated += ref new NavigatedEventHandler(this, &App::RootFrame_FirstNavigated); + + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter. + if (!rootFrame->Navigate(MainPage::typeid, e->Arguments)) + { + throw ref new FailureException("Failed to create initial page"); + } + } + + // Ensure the current window is active + Window::Current->Activate(); +} + +/// +/// Restores the content transitions after the app has launched. +/// +void App::RootFrame_FirstNavigated(Object^ sender, NavigationEventArgs^ e) +{ + auto rootFrame = safe_cast(sender); + + TransitionCollection^ newTransitions; + if (_transitions == nullptr) + { + newTransitions = ref new TransitionCollection(); + newTransitions->Append(ref new NavigationThemeTransition()); + } + else + { + newTransitions = _transitions; + } + + rootFrame->ContentTransitions = newTransitions; + rootFrame->Navigated -= _firstNavigatedToken; +} + +/// +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// +void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) +{ + (void) sender; // Unused parameter + (void) e; // Unused parameter + + // TODO: Save application state and stop any background activity +} \ No newline at end of file diff --git a/samples/winrt_universal/PhoneTutorial/App.xaml.h b/samples/winrt_universal/PhoneTutorial/App.xaml.h new file mode 100644 index 0000000000..c9a831cc32 --- /dev/null +++ b/samples/winrt_universal/PhoneTutorial/App.xaml.h @@ -0,0 +1,29 @@ +// +// App.xaml.h +// Declaration of the App class. +// + +#pragma once + +#include "App.g.h" + +namespace PhoneTutorial +{ + /// + /// Provides application-specific behavior to supplement the default Application class. + /// + ref class App sealed + { + public: + App(); + + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; + + private: + Windows::UI::Xaml::Media::Animation::TransitionCollection^ _transitions; + Windows::Foundation::EventRegistrationToken _firstNavigatedToken; + + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + void RootFrame_FirstNavigated(Platform::Object^ sender, Windows::UI::Xaml::Navigation::NavigationEventArgs^ e); + }; +} diff --git a/samples/winrt_universal/PhoneTutorial/Assets/Logo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/Logo.scale-240.png new file mode 100644 index 0000000000..76921ca997 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/Logo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/SmallLogo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/SmallLogo.scale-240.png new file mode 100644 index 0000000000..316630124f Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/SmallLogo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/SplashScreen.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/SplashScreen.scale-240.png new file mode 100644 index 0000000000..33f26b3310 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/SplashScreen.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/Square71x71Logo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/Square71x71Logo.scale-240.png new file mode 100644 index 0000000000..cfa54bee03 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/Square71x71Logo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/StoreLogo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/StoreLogo.scale-240.png new file mode 100644 index 0000000000..47e084b593 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/StoreLogo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Assets/WideLogo.scale-240.png b/samples/winrt_universal/PhoneTutorial/Assets/WideLogo.scale-240.png new file mode 100644 index 0000000000..6249d29db0 Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Assets/WideLogo.scale-240.png differ diff --git a/samples/winrt_universal/PhoneTutorial/Lena.png b/samples/winrt_universal/PhoneTutorial/Lena.png new file mode 100644 index 0000000000..3e8668734a Binary files /dev/null and b/samples/winrt_universal/PhoneTutorial/Lena.png differ diff --git a/samples/winrt_universal/PhoneTutorial/MainPage.xaml b/samples/winrt_universal/PhoneTutorial/MainPage.xaml new file mode 100644 index 0000000000..428b2fa99c --- /dev/null +++ b/samples/winrt_universal/PhoneTutorial/MainPage.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/wp8/OpenCVXaml/OpenCVXaml/MainPage.xaml.cs b/samples/wp8/OpenCVXaml/OpenCVXaml/MainPage.xaml.cs new file mode 100644 index 0000000000..ed4f4f1062 --- /dev/null +++ b/samples/wp8/OpenCVXaml/OpenCVXaml/MainPage.xaml.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using OpenCVXaml.Resources; +using System.Windows.Media.Imaging; +using OpenCVComponent; + +namespace OpenCVXaml +{ + public partial class MainPage : PhoneApplicationPage + { + private OpenCVLib m_opencv = new OpenCVLib(); + + // Constructor + public MainPage() + { + InitializeComponent(); + + // Sample code to localize the ApplicationBar + //BuildLocalizedApplicationBar(); + } + + private async void Button_Click(object sender, RoutedEventArgs e) + { + if (Preview.Source != null) + { + ProcessButton.IsEnabled = false; + + // Get WriteableBitmap. ImageToModify is defined in MainPage.xaml + WriteableBitmap bitmap = new WriteableBitmap(Preview.Source as BitmapSource); + + // call OpenCVLib to convert pixels to grayscale. This is an asynchronous call. + var pixels = await m_opencv.ProcessAsync(bitmap.Pixels, bitmap.PixelWidth, bitmap.PixelHeight); + + // copy the pixels into the WriteableBitmap + for (int x = 0; x < bitmap.Pixels.Length; x++) + { + bitmap.Pixels[x] = pixels[x]; + } + + // Set Image object, defined in XAML, to the modified bitmap. + Preview.Source = bitmap; + + ProcessButton.IsEnabled = true; + } + } + + // Sample code for building a localized ApplicationBar + //private void BuildLocalizedApplicationBar() + //{ + // // Set the page's ApplicationBar to a new instance of ApplicationBar. + // ApplicationBar = new ApplicationBar(); + + // // Create a new button and set the text value to the localized string from AppResources. + // ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative)); + // appBarButton.Text = AppResources.AppBarButtonText; + // ApplicationBar.Buttons.Add(appBarButton); + + // // Create a new menu item with the localized string from AppResources. + // ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText); + // ApplicationBar.MenuItems.Add(appBarMenuItem); + //} + } +} \ No newline at end of file diff --git a/samples/wp8/OpenCVXaml/OpenCVXaml/OpenCVXaml.csproj b/samples/wp8/OpenCVXaml/OpenCVXaml/OpenCVXaml.csproj new file mode 100644 index 0000000000..c648fd3d80 --- /dev/null +++ b/samples/wp8/OpenCVXaml/OpenCVXaml/OpenCVXaml.csproj @@ -0,0 +1,167 @@ + + + + Debug + AnyCPU + 10.0.20506 + 2.0 + {AF139C56-D9C7-4AFE-8972-E5B30AABA1BC} + {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + OpenCVXaml + OpenCVXaml + WindowsPhone + v8.0 + $(TargetFrameworkVersion) + true + + + true + true + OpenCVXaml_$(Configuration)_$(Platform).xap + Properties\AppManifest.xml + OpenCVXaml.App + true + 11.0 + true + + + true + full + false + Bin\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + true + full + false + Bin\x86\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\x86\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + true + full + false + Bin\ARM\Debug + DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + pdbonly + true + Bin\ARM\Release + TRACE;SILVERLIGHT;WINDOWS_PHONE + true + true + prompt + 4 + + + + App.xaml + + + + MainPage.xaml + + + + True + True + AppResources.resx + + + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + + Designer + + + + + + PreserveNewest + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + PublicResXFileCodeGenerator + AppResources.Designer.cs + + + + + {eadff7b8-e6c3-4f34-9b33-014b3035c595} + OpenCVComponent + + + + + + + \ No newline at end of file diff --git a/samples/wp8/OpenCVXaml/OpenCVXaml/Properties/AppManifest.xml b/samples/wp8/OpenCVXaml/OpenCVXaml/Properties/AppManifest.xml new file mode 100644 index 0000000000..a955232752 --- /dev/null +++ b/samples/wp8/OpenCVXaml/OpenCVXaml/Properties/AppManifest.xml @@ -0,0 +1,6 @@ + + + + diff --git a/samples/wp8/OpenCVXaml/OpenCVXaml/Properties/AssemblyInfo.cs b/samples/wp8/OpenCVXaml/OpenCVXaml/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..af7506ff3e --- /dev/null +++ b/samples/wp8/OpenCVXaml/OpenCVXaml/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Resources; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OpenCVXaml")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenCVXaml")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0ceefb1d-fe54-4732-bca5-865e13ecdbf0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: NeutralResourcesLanguageAttribute("en-US")] diff --git a/samples/wp8/OpenCVXaml/OpenCVXaml/Properties/WMAppManifest.xml b/samples/wp8/OpenCVXaml/OpenCVXaml/Properties/WMAppManifest.xml new file mode 100644 index 0000000000..8271a80321 --- /dev/null +++ b/samples/wp8/OpenCVXaml/OpenCVXaml/Properties/WMAppManifest.xml @@ -0,0 +1,38 @@ + + + + + + Assets\ApplicationIcon.png + + + + + + + + + + + + + + Assets\Tiles\FlipCycleTileSmall.png + 0 + Assets\Tiles\FlipCycleTileMedium.png + OpenCVXaml + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/wp8/OpenCVXaml/OpenCVXaml/Resources/AppResources.Designer.cs b/samples/wp8/OpenCVXaml/OpenCVXaml/Resources/AppResources.Designer.cs new file mode 100644 index 0000000000..90bcaa939c --- /dev/null +++ b/samples/wp8/OpenCVXaml/OpenCVXaml/Resources/AppResources.Designer.cs @@ -0,0 +1,127 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17626 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OpenCVXaml.Resources +{ + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class AppResources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal AppResources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenCVXaml.Resources.AppResources", typeof(AppResources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to LeftToRight. + /// + public static string ResourceFlowDirection + { + get + { + return ResourceManager.GetString("ResourceFlowDirection", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to us-EN. + /// + public static string ResourceLanguage + { + get + { + return ResourceManager.GetString("ResourceLanguage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MY APPLICATION. + /// + public static string ApplicationTitle + { + get + { + return ResourceManager.GetString("ApplicationTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to button. + /// + public static string AppBarButtonText + { + get + { + return ResourceManager.GetString("AppBarButtonText", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to menu item. + /// + public static string AppBarMenuItemText + { + get + { + return ResourceManager.GetString("AppBarMenuItemText", resourceCulture); + } + } + } +} diff --git a/samples/wp8/OpenCVXaml/OpenCVXaml/Resources/AppResources.resx b/samples/wp8/OpenCVXaml/OpenCVXaml/Resources/AppResources.resx new file mode 100644 index 0000000000..529a19431a --- /dev/null +++ b/samples/wp8/OpenCVXaml/OpenCVXaml/Resources/AppResources.resx @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + LeftToRight + Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language + + + en-US + Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language. + + + MY APPLICATION + + + add + + + Menu Item + + \ No newline at end of file diff --git a/samples/wp8/readme.txt b/samples/wp8/readme.txt new file mode 100644 index 0000000000..c25967cd3a --- /dev/null +++ b/samples/wp8/readme.txt @@ -0,0 +1,6 @@ +Building OpenCV Windows Phone Samples +===================================== + +Samples are created to run against x86 architecture OpenCV binaries. + +Please follow the instructions in "platforms/winrt/readme.txt" to generate and build OpenCV for Windows Phone 8.0/8.1 \ No newline at end of file