Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Prof. Dr. Rudolf Haussmann 2015-03-07 13:10:41 +01:00
commit 5e3d986ad8
211 changed files with 9070 additions and 707 deletions

9
.gitignore vendored
View File

@ -8,3 +8,12 @@
Thumbs.db
tags
tegra/
bin/
CMakeFiles/
*.sdf
*.opensdf
*.obj
*.stamp
*.depend
*.rule
*.tmp

View File

@ -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})

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -3,3 +3,4 @@ link_libraries(${OPENCV_LINKER_LIBS})
add_subdirectory(traincascade)
add_subdirectory(createsamples)
add_subdirectory(annotation)

View File

@ -0,0 +1,37 @@
SET(OPENCV_ANNOTATION_DEPS opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs opencv_videoio)
ocv_check_dependencies(${OPENCV_ANNOTATION_DEPS})
if(NOT OCV_DEPENDENCIES_FOUND)
return()
endif()
project(annotation)
set(the_target opencv_annotation)
ocv_target_include_directories(${the_target} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" "${OpenCV_SOURCE_DIR}/include/opencv")
ocv_target_include_modules(${the_target} ${OPENCV_ANNOTATION_DEPS})
file(GLOB SRCS *.cpp)
set(annotation_files ${SRCS})
ocv_add_executable(${the_target} ${annotation_files})
ocv_target_link_libraries(${the_target} ${OPENCV_ANNOTATION_DEPS})
set_target_properties(${the_target} PROPERTIES
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
INSTALL_NAME_DIR lib
OUTPUT_NAME "opencv_annotation")
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(${the_target} PROPERTIES FOLDER "applications")
endif()
if(INSTALL_CREATE_DISTRIB)
if(BUILD_SHARED_LIBS)
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} CONFIGURATIONS Release COMPONENT dev)
endif()
else()
install(TARGETS ${the_target} RUNTIME DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT dev)
endif()

View File

@ -0,0 +1,198 @@
/*****************************************************************************************************
USAGE:
./opencv_annotation -images <folder location> -annotations <ouput file>
Created by: Puttemans Steven
*****************************************************************************************************/
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/imgproc.hpp>
#include <fstream>
#include <iostream>
using namespace std;
using namespace cv;
// Function prototypes
void on_mouse(int, int, int, int, void*);
string int2string(int);
void get_annotations(Mat, stringstream*);
// Public parameters
Mat image;
int roi_x0 = 0, roi_y0 = 0, roi_x1 = 0, roi_y1 = 0, num_of_rec = 0;
bool start_draw = false;
// Window name for visualisation purposes
const string window_name="OpenCV Based Annotation Tool";
// FUNCTION : Mouse response for selecting objects in images
// If left button is clicked, start drawing a rectangle as long as mouse moves
// Stop drawing once a new left click is detected by the on_mouse function
void on_mouse(int event, int x, int y, int , void * )
{
// Action when left button is clicked
if(event == EVENT_LBUTTONDOWN)
{
if(!start_draw)
{
roi_x0 = x;
roi_y0 = y;
start_draw = true;
} else {
roi_x1 = x;
roi_y1 = y;
start_draw = false;
}
}
// Action when mouse is moving
if((event == EVENT_MOUSEMOVE) && start_draw)
{
// Redraw bounding box for annotation
Mat current_view;
image.copyTo(current_view);
rectangle(current_view, Point(roi_x0,roi_y0), Point(x,y), Scalar(0,0,255));
imshow(window_name, current_view);
}
}
// FUNCTION : snippet to convert an integer value to a string using a clean function
// instead of creating a stringstream each time inside the main code
string int2string(int num)
{
stringstream temp_stream;
temp_stream << num;
return temp_stream.str();
}
// FUNCTION : given an image containing positive object instances, add all the object
// annotations to a known stringstream
void get_annotations(Mat input_image, stringstream* output_stream)
{
// Make it possible to exit the annotation
bool stop = false;
// Reset the num_of_rec element at each iteration
// Make sure the global image is set to the current image
num_of_rec = 0;
image = input_image;
// Init window interface and couple mouse actions
namedWindow(window_name, WINDOW_AUTOSIZE);
setMouseCallback(window_name, on_mouse);
imshow(window_name, image);
stringstream temp_stream;
int key_pressed = 0;
do
{
// Keys for processing
// You need to select one for confirming a selection and one to continue to the next image
// Based on the universal ASCII code of the keystroke: http://www.asciitable.com/
// c = 99 add rectangle to current image
// n = 110 save added rectangles and show next image
// <ESC> = 27 exit program
key_pressed = 0xFF & waitKey(0);
switch( key_pressed )
{
case 27:
destroyWindow(window_name);
stop = true;
case 99:
// Add a rectangle to the list
num_of_rec++;
// Draw initiated from top left corner
if(roi_x0<roi_x1 && roi_y0<roi_y1)
{
temp_stream << " " << int2string(roi_x0) << " " << int2string(roi_y0) << " " << int2string(roi_x1-roi_x0) << " " << int2string(roi_y1-roi_y0);
}
// Draw initiated from bottom right corner
if(roi_x0>roi_x1 && roi_y0>roi_y1)
{
temp_stream << " " << int2string(roi_x1) << " " << int2string(roi_y1) << " " << int2string(roi_x0-roi_x1) << " " << int2string(roi_y0-roi_y1);
}
// Draw initiated from top right corner
if(roi_x0>roi_x1 && roi_y0<roi_y1)
{
temp_stream << " " << int2string(roi_x1) << " " << int2string(roi_y0) << " " << int2string(roi_x0-roi_x1) << " " << int2string(roi_y1-roi_y0);
}
// Draw initiated from bottom left corner
if(roi_x0<roi_x1 && roi_y0>roi_y1)
{
temp_stream << " " << int2string(roi_x0) << " " << int2string(roi_y1) << " " << int2string(roi_x1-roi_x0) << " " << int2string(roi_y0-roi_y1);
}
rectangle(input_image, Point(roi_x0,roi_y0), Point(roi_x1,roi_y1), Scalar(0,255,0), 1);
break;
}
// Check if escape has been pressed
if(stop)
{
break;
}
}
// Continue as long as the next image key has not been pressed
while(key_pressed != 110);
// If there are annotations AND the next image key is pressed
// Write the image annotations to the file
if(num_of_rec>0 && key_pressed==110)
{
*output_stream << " " << num_of_rec << temp_stream.str() << endl;
}
// Close down the window
destroyWindow(window_name);
}
int main( int argc, const char** argv )
{
// Read in the input arguments
string image_folder;
string annotations;
for(int i = 1; i < argc; ++i )
{
if( !strcmp( argv[i], "-images" ) )
{
image_folder = argv[++i];
}
else if( !strcmp( argv[i], "-annotations" ) )
{
annotations = argv[++i];
}
}
// Create the outputfilestream
ofstream output(annotations.c_str());
// Return the image filenames inside the image folder
vector<String> filenames;
String folder(image_folder);
glob(folder, filenames);
// Loop through each image stored in the images folder
// Create and temporarily store the annotations
// At the end write everything to the annotations file
for (size_t i = 0; i < filenames.size(); i++){
// Read in an image
Mat current_image = imread(filenames[i]);
// Perform annotations & generate corresponding output
stringstream output_stream;
get_annotations(current_image, &output_stream);
// Store the annotations, write to the output file
if (output_stream.str() != ""){
output << filenames[i] << output_stream.str();
}
}
return 0;
}

View File

@ -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)

View File

@ -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)

View File

@ -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()

View File

@ -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)

View File

@ -169,9 +169,6 @@
/* Win32 UI */
#cmakedefine HAVE_WIN32UI
/* Windows Runtime support */
#cmakedefine HAVE_WINRT
/* XIMEA camera support */
#cmakedefine HAVE_XIMEA

View File

@ -49,7 +49,7 @@ pyopencv_generated_\*.h files). But there may be some basic OpenCV datatypes lik
Size. They need to be extended manually. For example, a Mat type should be extended to Numpy array,
Size should be extended to a tuple of two integers etc. Similarly, there may be some complex
structs/classes/functions etc. which need to be extended manually. All such manual wrapper functions
are placed in modules/python/src2/pycv2.hpp.
are placed in modules/python/src2/cv2.cpp.
So now only thing left is the compilation of these wrapper files which gives us **cv2** module. So
when you call a function, say res = equalizeHist(img1,img2) in Python, you pass two numpy arrays and

View File

@ -59,7 +59,7 @@ denotes they are the parameters of possible lines in the image. (Image courtesy:
![](images/houghlines2.jpg)
Hough Tranform in OpenCV
Hough Transform in OpenCV
=========================
Everything explained above is encapsulated in the OpenCV function, \*\*cv2.HoughLines()\*\*. It simply returns an array of :math:(rho,
@ -78,7 +78,8 @@ gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray,50,150,apertureSize = 3)
lines = cv2.HoughLines(edges,1,np.pi/180,200)
for rho,theta in lines[0]:
for line in lines:
rho,theta = line[0]
a = np.cos(theta)
b = np.sin(theta)
x0 = a*rho
@ -123,10 +124,9 @@ import numpy as np
img = cv2.imread('dave.jpg')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray,50,150,apertureSize = 3)
minLineLength = 100
maxLineGap = 10
lines = cv2.HoughLinesP(edges,1,np.pi/180,100,minLineLength,maxLineGap)
for x1,y1,x2,y2 in lines[0]:
lines = cv2.HoughLinesP(edges,1,np.pi/180,100,minLineLength=100,maxLineGap=10)
for line in lines:
x1,y1,x2,y2 = line[0]
cv2.line(img,(x1,y1),(x2,y2),(0,255,0),2)
cv2.imwrite('houghlines5.jpg',img)

View File

@ -54,25 +54,19 @@ int main( int argc, char** argv )
if( !img_1.data || !img_2.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
//-- Step 1: Detect the keypoints using SURF Detector
//-- Step 1: Detect the keypoints using SURF Detector, compute the descriptors
int minHessian = 400;
SurfFeatureDetector detector( minHessian );
Ptr<SURF> detector = SURF::create();
detector->setMinHessian(minHessian);
std::vector<KeyPoint> keypoints_1, keypoints_2;
detector.detect( img_1, keypoints_1 );
detector.detect( img_2, keypoints_2 );
//-- Step 2: Calculate descriptors (feature vectors)
SurfDescriptorExtractor extractor;
Mat descriptors_1, descriptors_2;
extractor.compute( img_1, keypoints_1, descriptors_1 );
extractor.compute( img_2, keypoints_2, descriptors_2 );
detector->detectAndCompute( img_1, keypoints_1, descriptors_1 );
detector->detectAndCompute( img_2, keypoints_2, descriptors_2 );
//-- Step 3: Matching descriptor vectors using FLANN matcher
//-- Step 2: Matching descriptor vectors using FLANN matcher
FlannBasedMatcher matcher;
std::vector< DMatch > matches;
matcher.match( descriptors_1, descriptors_2, matches );

View File

@ -42,25 +42,18 @@ int main( int argc, char** argv )
if( !img_object.data || !img_scene.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
//-- Step 1: Detect the keypoints using SURF Detector
//-- Step 1: Detect the keypoints and extract descriptors using SURF
int minHessian = 400;
SurfFeatureDetector detector( minHessian );
Ptr<SURF> detector = SURF::create( minHessian );
std::vector<KeyPoint> keypoints_object, keypoints_scene;
detector.detect( img_object, keypoints_object );
detector.detect( img_scene, keypoints_scene );
//-- Step 2: Calculate descriptors (feature vectors)
SurfDescriptorExtractor extractor;
Mat descriptors_object, descriptors_scene;
extractor.compute( img_object, keypoints_object, descriptors_object );
extractor.compute( img_scene, keypoints_scene, descriptors_scene );
detector->detectAndCompute( img_object, keypoints_object, descriptors_object );
detector->detectAndCompute( img_scene, keypoints_scene, descriptors_scene );
//-- Step 3: Matching descriptor vectors using FLANN matcher
//-- Step 2: Matching descriptor vectors using FLANN matcher
FlannBasedMatcher matcher;
std::vector< DMatch > matches;
matcher.match( descriptors_object, descriptors_scene, matches );

View File

@ -1047,14 +1047,14 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
return;
}
CameraHandler* handler=*ppcameraHandler;
// delayed resolution setup to exclude errors during other parameres setup on the fly
// without camera restart
if (((*ppcameraHandler)->width != 0) && ((*ppcameraHandler)->height != 0))
(*ppcameraHandler)->params->setPreviewSize((*ppcameraHandler)->width, (*ppcameraHandler)->height);
if ((handler->width != 0) && (handler->height != 0))
handler->params->setPreviewSize(handler->width, handler->height);
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0) \
|| defined(ANDROID_r4_3_0) || defined(ANDROID_r4_4_0)
CameraHandler* handler=*ppcameraHandler;
handler->camera->stopPreview();
handler->camera->setPreviewCallbackFlags(CAMERA_FRAME_CALLBACK_FLAG_NOOP);
@ -1066,7 +1066,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
return;
}
handler->camera->setParameters((*ppcameraHandler)->params->flatten());
handler->camera->setParameters(handler->params->flatten());
status_t bufferStatus;
# if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
@ -1107,7 +1107,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
LOGD("Preview started successfully");
}
#else
CameraHandler* previousCameraHandler=*ppcameraHandler;
CameraHandler* previousCameraHandler=handler;
CameraCallback cameraCallback=previousCameraHandler->cameraCallback;
void* userData=previousCameraHandler->userData;
int cameraId=previousCameraHandler->cameraId;
@ -1117,7 +1117,7 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler)
LOGD("CameraHandler::applyProperties(): after previousCameraHandler->closeCameraConnect");
LOGD("CameraHandler::applyProperties(): before initCameraConnect");
CameraHandler* handler=initCameraConnect(cameraCallback, cameraId, userData, (*ppcameraHandler)->params);
handler=initCameraConnect(cameraCallback, cameraId, userData, handler->params);
LOGD("CameraHandler::applyProperties(): after initCameraConnect, handler=0x%x", (int)handler);
if (handler == NULL) {
LOGE("ERROR in applyProperties --- cannot reinit camera");

View File

@ -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()

View File

@ -184,6 +184,7 @@ public:
// After fix restore code in arithm.cpp: ocl_compare()
inline bool isAMD() const { return vendorID() == VENDOR_AMD; }
inline bool isIntel() const { return vendorID() == VENDOR_INTEL; }
inline bool isNVidia() const { return vendorID() == VENDOR_NVIDIA; }
int maxClockFrequency() const;
int maxComputeUnits() const;

View File

@ -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));

View File

@ -180,10 +180,9 @@ public:
const int K = centers.rows;
const int dims = centers.cols;
const float *sample;
for( int i = begin; i<end; ++i)
{
sample = data.ptr<float>(i);
const float *sample = data.ptr<float>(i);
int k_best = 0;
double min_dist = DBL_MAX;

View File

@ -205,9 +205,12 @@ public:
void deallocate(UMatData* u) const
{
if(!u)
return;
CV_Assert(u->urefcount >= 0);
CV_Assert(u->refcount >= 0);
if(u && u->refcount == 0)
if(u->refcount == 0)
{
if( !(u->flags & UMatData::USER_ALLOCATED) )
{

View File

@ -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;

View File

@ -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 );

View File

@ -2114,6 +2114,12 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int*
int ddepth = -1, bool absValues = false, InputArray _src2 = noArray(), double * maxVal2 = NULL)
{
const ocl::Device & dev = ocl::Device::getDefault();
#ifdef ANDROID
if (dev.isNVidia())
return false;
#endif
bool doubleSupport = dev.doubleFPConfig() > 0, haveMask = !_mask.empty(),
haveSrc2 = _src2.kind() != _InputArray::NONE;
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type),
@ -2885,6 +2891,12 @@ static NormDiffFunc getNormDiffFunc(int normType, int depth)
static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double & result )
{
const ocl::Device & d = ocl::Device::getDefault();
#ifdef ANDROID
if (d.isNVidia())
return false;
#endif
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
bool doubleSupport = d.doubleFPConfig() > 0,
haveMask = _mask.kind() != _InputArray::NONE;
@ -3250,6 +3262,11 @@ namespace cv {
static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask, double & result )
{
#ifdef ANDROID
if (ocl::Device::getDefault().isNVidia())
return false;
#endif
Scalar sc1, sc2;
int type = _src1.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
bool relative = (normType & NORM_RELATIVE) != 0;

View File

@ -109,7 +109,7 @@
#endif
#endif
#ifdef HAVE_WINRT
#ifdef WINRT
#include <wrl/client.h>
#ifndef __cplusplus_winrt
#include <windows.storage.h>
@ -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
@ -327,9 +327,9 @@ struct HWFeatures
if (cpufile >= 0)
{
Elf32_auxv_t auxv;
const size_t size_auxv_t = sizeof(Elf32_auxv_t);
const size_t size_auxv_t = sizeof(auxv);
while ((size_t)read(cpufile, &auxv, sizeof(Elf32_auxv_t)) == size_auxv_t)
while ((size_t)read(cpufile, &auxv, size_auxv_t) == size_auxv_t)
{
if (auxv.a_type == AT_HWCAP)
{
@ -542,24 +542,20 @@ 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();
if (opencv_temp_dir)
temp_dir = std::wstring(opencv_temp_dir);
std::wstring temp_dir = GetTempPathWinRT();
std::wstring temp_file;
temp_file = GetTempFileNameWinRT(L"ocv");
std::wstring temp_file = GetTempFileNameWinRT(L"ocv");
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 +951,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 +1002,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

View File

@ -331,7 +331,11 @@ OCL_TEST_P(Mul, Mat_Scale)
OCL_OFF(cv::multiply(src1_roi, src2_roi, dst1_roi, val[0]));
OCL_ON(cv::multiply(usrc1_roi, usrc2_roi, udst1_roi, val[0]));
#ifdef ANDROID
Near(udst1_roi.depth() >= CV_32F ? 2e-1 : 1);
#else
Near(udst1_roi.depth() >= CV_32F ? 1e-3 : 1);
#endif
}
}

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -61,6 +61,12 @@ OCL_PERF_TEST_P(ORBFixture, ORB_Full, ORB_IMAGES)
string filename = getDataPath(GetParam());
Mat mframe = imread(filename, IMREAD_GRAYSCALE);
double desc_eps = 1e-6;
#ifdef ANDROID
if (cv::ocl::Device::getDefault().isNVidia())
desc_eps = 2;
#endif
if (mframe.empty())
FAIL() << "Unable to load source image " << filename;
@ -77,7 +83,7 @@ OCL_PERF_TEST_P(ORBFixture, ORB_Full, ORB_IMAGES)
::perf::sort(points, descriptors);
SANITY_CHECK_KEYPOINTS(points, 1e-5);
SANITY_CHECK(descriptors);
SANITY_CHECK(descriptors, desc_eps);
}
} // ocl

View File

@ -172,7 +172,14 @@ namespace cv
cvtColor(image, img, COLOR_BGR2GRAY);
Mat img1_32;
img.convertTo(img1_32, CV_32F, 1.0 / 255.0, 0);
if ( img.depth() == CV_32F )
img1_32 = img;
else if ( img.depth() == CV_8U )
img.convertTo(img1_32, CV_32F, 1.0 / 255.0, 0);
else if ( img.depth() == CV_16U )
img.convertTo(img1_32, CV_32F, 1.0 / 65535.0, 0);
CV_Assert( ! img1_32.empty() );
AKAZEOptions options;
options.descriptor = descriptor;

View File

@ -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()

View File

@ -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()

View File

@ -1221,7 +1221,22 @@ CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth,
bool normalize = true,
int borderType = BORDER_DEFAULT );
/** @todo document
/** @brief Calculates the normalized sum of squares of the pixel values overlapping the filter.
For every pixel \f$ (x, y) \f$ in the source image, the function calculates the sum of squares of those neighboring
pixel values which overlap the filter placed over the pixel \f$ (x, y) \f$.
The unnormalized square box filter can be useful in computing local image statistics such as the the local
variance and standard deviation around the neighborhood of a pixel.
@param _src input image
@param _dst output image of the same size and type as _src
@param ddepth the output image depth (-1 to use src.depth())
@param ksize kernel size
@param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
center.
@param normalize flag, specifying whether the kernel is to be normalized by it's area or not.
@param borderType border mode used to extrapolate pixels outside of the image, see cv::BorderTypes
@sa boxFilter
*/
CV_EXPORTS_W void sqrBoxFilter( InputArray _src, OutputArray _dst, int ddepth,

View File

@ -230,7 +230,352 @@ static bool ocl_Canny(InputArray _src, OutputArray _dst, float low_thresh, float
#endif
}
#ifdef HAVE_TBB
// Queue with peaks that will processed serially.
static tbb::concurrent_queue<uchar*> borderPeaks;
class tbbCanny
{
public:
tbbCanny(const Range _boundaries, const Mat& _src, uchar* _map, int _low,
int _high, int _aperture_size, bool _L2gradient)
: boundaries(_boundaries), src(_src), map(_map), low(_low), high(_high),
aperture_size(_aperture_size), L2gradient(_L2gradient)
{}
// This parallel version of Canny algorithm splits the src image in threadsNumber horizontal slices.
// The first row of each slice contains the last row of the previous slice and
// the last row of each slice contains the first row of the next slice
// so that each slice is independent and no mutexes are required.
void operator()() const
{
#if CV_SSE2
bool haveSSE2 = checkHardwareSupport(CV_CPU_SSE2);
#endif
const int type = src.type(), cn = CV_MAT_CN(type);
Mat dx, dy;
ptrdiff_t mapstep = src.cols + 2;
// In sobel transform we calculate ksize2 extra lines for the first and last rows of each slice
// because IPPDerivSobel expects only isolated ROIs, in contrast with the opencv version which
// uses the pixels outside of the ROI to form a border.
uchar ksize2 = aperture_size / 2;
if (boundaries.start == 0 && boundaries.end == src.rows)
{
Mat tempdx(boundaries.end - boundaries.start + 2, src.cols, CV_16SC(cn));
Mat tempdy(boundaries.end - boundaries.start + 2, src.cols, CV_16SC(cn));
memset(tempdx.ptr<short>(0), 0, cn * src.cols*sizeof(short));
memset(tempdy.ptr<short>(0), 0, cn * src.cols*sizeof(short));
memset(tempdx.ptr<short>(tempdx.rows - 1), 0, cn * src.cols*sizeof(short));
memset(tempdy.ptr<short>(tempdy.rows - 1), 0, cn * src.cols*sizeof(short));
Sobel(src, tempdx.rowRange(1, tempdx.rows - 1), CV_16S, 1, 0, aperture_size, 1, 0, BORDER_REPLICATE);
Sobel(src, tempdy.rowRange(1, tempdy.rows - 1), CV_16S, 0, 1, aperture_size, 1, 0, BORDER_REPLICATE);
dx = tempdx;
dy = tempdy;
}
else if (boundaries.start == 0)
{
Mat tempdx(boundaries.end - boundaries.start + 2 + ksize2, src.cols, CV_16SC(cn));
Mat tempdy(boundaries.end - boundaries.start + 2 + ksize2, src.cols, CV_16SC(cn));
memset(tempdx.ptr<short>(0), 0, cn * src.cols*sizeof(short));
memset(tempdy.ptr<short>(0), 0, cn * src.cols*sizeof(short));
Sobel(src.rowRange(boundaries.start, boundaries.end + 1 + ksize2), tempdx.rowRange(1, tempdx.rows),
CV_16S, 1, 0, aperture_size, 1, 0, BORDER_REPLICATE);
Sobel(src.rowRange(boundaries.start, boundaries.end + 1 + ksize2), tempdy.rowRange(1, tempdy.rows),
CV_16S, 0, 1, aperture_size, 1, 0, BORDER_REPLICATE);
dx = tempdx.rowRange(0, tempdx.rows - ksize2);
dy = tempdy.rowRange(0, tempdy.rows - ksize2);
}
else if (boundaries.end == src.rows)
{
Mat tempdx(boundaries.end - boundaries.start + 2 + ksize2, src.cols, CV_16SC(cn));
Mat tempdy(boundaries.end - boundaries.start + 2 + ksize2, src.cols, CV_16SC(cn));
memset(tempdx.ptr<short>(tempdx.rows - 1), 0, cn * src.cols*sizeof(short));
memset(tempdy.ptr<short>(tempdy.rows - 1), 0, cn * src.cols*sizeof(short));
Sobel(src.rowRange(boundaries.start - 1 - ksize2, boundaries.end), tempdx.rowRange(0, tempdx.rows - 1),
CV_16S, 1, 0, aperture_size, 1, 0, BORDER_REPLICATE);
Sobel(src.rowRange(boundaries.start - 1 - ksize2, boundaries.end), tempdy.rowRange(0, tempdy.rows - 1),
CV_16S, 0, 1, aperture_size, 1, 0, BORDER_REPLICATE);
dx = tempdx.rowRange(ksize2, tempdx.rows);
dy = tempdy.rowRange(ksize2, tempdy.rows);
}
else
{
Mat tempdx(boundaries.end - boundaries.start + 2 + 2*ksize2, src.cols, CV_16SC(cn));
Mat tempdy(boundaries.end - boundaries.start + 2 + 2*ksize2, src.cols, CV_16SC(cn));
Sobel(src.rowRange(boundaries.start - 1 - ksize2, boundaries.end + 1 + ksize2), tempdx,
CV_16S, 1, 0, aperture_size, 1, 0, BORDER_REPLICATE);
Sobel(src.rowRange(boundaries.start - 1 - ksize2, boundaries.end + 1 + ksize2), tempdy,
CV_16S, 0, 1, aperture_size, 1, 0, BORDER_REPLICATE);
dx = tempdx.rowRange(ksize2, tempdx.rows - ksize2);
dy = tempdy.rowRange(ksize2, tempdy.rows - ksize2);
}
int maxsize = std::max(1 << 10, src.cols * (boundaries.end - boundaries.start) / 10);
std::vector<uchar*> stack(maxsize);
uchar **stack_top = &stack[0];
uchar **stack_bottom = &stack[0];
AutoBuffer<uchar> buffer(cn * mapstep * 3 * sizeof(int));
int* mag_buf[3];
mag_buf[0] = (int*)(uchar*)buffer;
mag_buf[1] = mag_buf[0] + mapstep*cn;
mag_buf[2] = mag_buf[1] + mapstep*cn;
// calculate magnitude and angle of gradient, perform non-maxima suppression.
// fill the map with one of the following values:
// 0 - the pixel might belong to an edge
// 1 - the pixel can not belong to an edge
// 2 - the pixel does belong to an edge
for (int i = boundaries.start - 1; i <= boundaries.end; i++)
{
int* _norm = mag_buf[(i > boundaries.start) - (i == boundaries.start - 1) + 1] + 1;
short* _dx = dx.ptr<short>(i - boundaries.start + 1);
short* _dy = dy.ptr<short>(i - boundaries.start + 1);
if (!L2gradient)
{
int j = 0, width = src.cols * cn;
#if CV_SSE2
if (haveSSE2)
{
__m128i v_zero = _mm_setzero_si128();
for ( ; j <= width - 8; j += 8)
{
__m128i v_dx = _mm_loadu_si128((const __m128i *)(_dx + j));
__m128i v_dy = _mm_loadu_si128((const __m128i *)(_dy + j));
v_dx = _mm_max_epi16(v_dx, _mm_sub_epi16(v_zero, v_dx));
v_dy = _mm_max_epi16(v_dy, _mm_sub_epi16(v_zero, v_dy));
__m128i v_norm = _mm_add_epi32(_mm_unpacklo_epi16(v_dx, v_zero), _mm_unpacklo_epi16(v_dy, v_zero));
_mm_storeu_si128((__m128i *)(_norm + j), v_norm);
v_norm = _mm_add_epi32(_mm_unpackhi_epi16(v_dx, v_zero), _mm_unpackhi_epi16(v_dy, v_zero));
_mm_storeu_si128((__m128i *)(_norm + j + 4), v_norm);
}
}
#elif CV_NEON
for ( ; j <= width - 8; j += 8)
{
int16x8_t v_dx = vld1q_s16(_dx + j), v_dy = vld1q_s16(_dy + j);
vst1q_s32(_norm + j, vaddq_s32(vabsq_s32(vmovl_s16(vget_low_s16(v_dx))),
vabsq_s32(vmovl_s16(vget_low_s16(v_dy)))));
vst1q_s32(_norm + j + 4, vaddq_s32(vabsq_s32(vmovl_s16(vget_high_s16(v_dx))),
vabsq_s32(vmovl_s16(vget_high_s16(v_dy)))));
}
#endif
for ( ; j < width; ++j)
_norm[j] = std::abs(int(_dx[j])) + std::abs(int(_dy[j]));
}
else
{
int j = 0, width = src.cols * cn;
#if CV_SSE2
if (haveSSE2)
{
for ( ; j <= width - 8; j += 8)
{
__m128i v_dx = _mm_loadu_si128((const __m128i *)(_dx + j));
__m128i v_dy = _mm_loadu_si128((const __m128i *)(_dy + j));
__m128i v_dx_ml = _mm_mullo_epi16(v_dx, v_dx), v_dx_mh = _mm_mulhi_epi16(v_dx, v_dx);
__m128i v_dy_ml = _mm_mullo_epi16(v_dy, v_dy), v_dy_mh = _mm_mulhi_epi16(v_dy, v_dy);
__m128i v_norm = _mm_add_epi32(_mm_unpacklo_epi16(v_dx_ml, v_dx_mh), _mm_unpacklo_epi16(v_dy_ml, v_dy_mh));
_mm_storeu_si128((__m128i *)(_norm + j), v_norm);
v_norm = _mm_add_epi32(_mm_unpackhi_epi16(v_dx_ml, v_dx_mh), _mm_unpackhi_epi16(v_dy_ml, v_dy_mh));
_mm_storeu_si128((__m128i *)(_norm + j + 4), v_norm);
}
}
#elif CV_NEON
for ( ; j <= width - 8; j += 8)
{
int16x8_t v_dx = vld1q_s16(_dx + j), v_dy = vld1q_s16(_dy + j);
int16x4_t v_dxp = vget_low_s16(v_dx), v_dyp = vget_low_s16(v_dy);
int32x4_t v_dst = vmlal_s16(vmull_s16(v_dxp, v_dxp), v_dyp, v_dyp);
vst1q_s32(_norm + j, v_dst);
v_dxp = vget_high_s16(v_dx), v_dyp = vget_high_s16(v_dy);
v_dst = vmlal_s16(vmull_s16(v_dxp, v_dxp), v_dyp, v_dyp);
vst1q_s32(_norm + j + 4, v_dst);
}
#endif
for ( ; j < width; ++j)
_norm[j] = int(_dx[j])*_dx[j] + int(_dy[j])*_dy[j];
}
if (cn > 1)
{
for(int j = 0, jn = 0; j < src.cols; ++j, jn += cn)
{
int maxIdx = jn;
for(int k = 1; k < cn; ++k)
if(_norm[jn + k] > _norm[maxIdx]) maxIdx = jn + k;
_norm[j] = _norm[maxIdx];
_dx[j] = _dx[maxIdx];
_dy[j] = _dy[maxIdx];
}
}
_norm[-1] = _norm[src.cols] = 0;
// at the very beginning we do not have a complete ring
// buffer of 3 magnitude rows for non-maxima suppression
if (i <= boundaries.start)
continue;
uchar* _map = map + mapstep*i + 1;
_map[-1] = _map[src.cols] = 1;
int* _mag = mag_buf[1] + 1; // take the central row
ptrdiff_t magstep1 = mag_buf[2] - mag_buf[1];
ptrdiff_t magstep2 = mag_buf[0] - mag_buf[1];
const short* _x = dx.ptr<short>(i - boundaries.start);
const short* _y = dy.ptr<short>(i - boundaries.start);
if ((stack_top - stack_bottom) + src.cols > maxsize)
{
int sz = (int)(stack_top - stack_bottom);
maxsize = std::max(maxsize * 3/2, sz + src.cols);
stack.resize(maxsize);
stack_bottom = &stack[0];
stack_top = stack_bottom + sz;
}
#define CANNY_PUSH(d) *(d) = uchar(2), *stack_top++ = (d)
#define CANNY_POP(d) (d) = *--stack_top
int prev_flag = 0;
bool canny_push = false;
for (int j = 0; j < src.cols; j++)
{
#define CANNY_SHIFT 15
const int TG22 = (int)(0.4142135623730950488016887242097*(1<<CANNY_SHIFT) + 0.5);
int m = _mag[j];
if (m > low)
{
int xs = _x[j];
int ys = _y[j];
int x = std::abs(xs);
int y = std::abs(ys) << CANNY_SHIFT;
int tg22x = x * TG22;
if (y < tg22x)
{
if (m > _mag[j-1] && m >= _mag[j+1]) canny_push = true;
}
else
{
int tg67x = tg22x + (x << (CANNY_SHIFT+1));
if (y > tg67x)
{
if (m > _mag[j+magstep2] && m >= _mag[j+magstep1]) canny_push = true;
}
else
{
int s = (xs ^ ys) < 0 ? -1 : 1;
if (m > _mag[j+magstep2-s] && m > _mag[j+magstep1+s]) canny_push = true;
}
}
}
if (!canny_push)
{
prev_flag = 0;
_map[j] = uchar(1);
continue;
}
else
{
// _map[j-mapstep] is short-circuited at the start because previous thread is
// responsible for initializing it.
if (!prev_flag && m > high && (i <= boundaries.start+1 || _map[j-mapstep] != 2) )
{
CANNY_PUSH(_map + j);
prev_flag = 1;
}
else
_map[j] = 0;
canny_push = false;
}
}
// scroll the ring buffer
_mag = mag_buf[0];
mag_buf[0] = mag_buf[1];
mag_buf[1] = mag_buf[2];
mag_buf[2] = _mag;
}
// now track the edges (hysteresis thresholding)
while (stack_top > stack_bottom)
{
if ((stack_top - stack_bottom) + 8 > maxsize)
{
int sz = (int)(stack_top - stack_bottom);
maxsize = maxsize * 3/2;
stack.resize(maxsize);
stack_bottom = &stack[0];
stack_top = stack_bottom + sz;
}
uchar* m;
CANNY_POP(m);
// Stops thresholding from expanding to other slices by sending pixels in the borders of each
// slice in a queue to be serially processed later.
if ( (m < map + (boundaries.start + 2) * mapstep) || (m >= map + boundaries.end * mapstep) )
{
borderPeaks.push(m);
continue;
}
if (!m[-1]) CANNY_PUSH(m - 1);
if (!m[1]) CANNY_PUSH(m + 1);
if (!m[-mapstep-1]) CANNY_PUSH(m - mapstep - 1);
if (!m[-mapstep]) CANNY_PUSH(m - mapstep);
if (!m[-mapstep+1]) CANNY_PUSH(m - mapstep + 1);
if (!m[mapstep-1]) CANNY_PUSH(m + mapstep - 1);
if (!m[mapstep]) CANNY_PUSH(m + mapstep);
if (!m[mapstep+1]) CANNY_PUSH(m + mapstep + 1);
}
}
private:
const Range boundaries;
const Mat& src;
uchar* map;
int low;
int high;
int aperture_size;
bool L2gradient;
};
#endif
} // namespace cv
void cv::Canny( InputArray _src, OutputArray _dst,
double low_thresh, double high_thresh,
@ -280,6 +625,69 @@ void cv::Canny( InputArray _src, OutputArray _dst,
}
#endif
#ifdef HAVE_TBB
if (L2gradient)
{
low_thresh = std::min(32767.0, low_thresh);
high_thresh = std::min(32767.0, high_thresh);
if (low_thresh > 0) low_thresh *= low_thresh;
if (high_thresh > 0) high_thresh *= high_thresh;
}
int low = cvFloor(low_thresh);
int high = cvFloor(high_thresh);
ptrdiff_t mapstep = src.cols + 2;
AutoBuffer<uchar> buffer((src.cols+2)*(src.rows+2));
uchar* map = (uchar*)buffer;
memset(map, 1, mapstep);
memset(map + mapstep*(src.rows + 1), 1, mapstep);
int threadsNumber = tbb::task_scheduler_init::default_num_threads();
int grainSize = src.rows / threadsNumber;
// Make a fallback for pictures with too few rows.
uchar ksize2 = aperture_size / 2;
int minGrainSize = 1 + ksize2;
int maxGrainSize = src.rows - 2 - 2*ksize2;
if ( !( minGrainSize <= grainSize && grainSize <= maxGrainSize ) )
{
threadsNumber = 1;
grainSize = src.rows;
}
tbb::task_group g;
for (int i = 0; i < threadsNumber; ++i)
{
if (i < threadsNumber - 1)
g.run(tbbCanny(Range(i * grainSize, (i + 1) * grainSize), src, map, low, high, aperture_size, L2gradient));
else
g.run(tbbCanny(Range(i * grainSize, src.rows), src, map, low, high, aperture_size, L2gradient));
}
g.wait();
#define CANNY_PUSH_SERIAL(d) *(d) = uchar(2), borderPeaks.push(d)
// now track the edges (hysteresis thresholding)
uchar* m;
while (borderPeaks.try_pop(m))
{
if (!m[-1]) CANNY_PUSH_SERIAL(m - 1);
if (!m[1]) CANNY_PUSH_SERIAL(m + 1);
if (!m[-mapstep-1]) CANNY_PUSH_SERIAL(m - mapstep - 1);
if (!m[-mapstep]) CANNY_PUSH_SERIAL(m - mapstep);
if (!m[-mapstep+1]) CANNY_PUSH_SERIAL(m - mapstep + 1);
if (!m[mapstep-1]) CANNY_PUSH_SERIAL(m + mapstep - 1);
if (!m[mapstep]) CANNY_PUSH_SERIAL(m + mapstep);
if (!m[mapstep+1]) CANNY_PUSH_SERIAL(m + mapstep + 1);
}
#else
Mat dx(src.rows, src.cols, CV_16SC(cn));
Mat dy(src.rows, src.cols, CV_16SC(cn));
@ -540,6 +948,8 @@ __ocv_canny_push:
if (!m[mapstep+1]) CANNY_PUSH(m + mapstep + 1);
}
#endif
// the final pass, form the final image
const uchar* pmap = map + mapstep + 1;
uchar* pdst = dst.ptr();

View File

@ -1548,7 +1548,7 @@ static bool ocl_morphOp(InputArray _src, OutputArray _dst, InputArray _kernel,
return true;
}
#if defined ANDROID
#ifdef ANDROID
size_t localThreads[2] = { 16, 8 };
#else
size_t localThreads[2] = { 16, 16 };
@ -1563,6 +1563,11 @@ static bool ocl_morphOp(InputArray _src, OutputArray _dst, InputArray _kernel,
if (localThreads[0]*localThreads[1] * 2 < (localThreads[0] + ksize.width - 1) * (localThreads[1] + ksize.height - 1))
return false;
#ifdef ANDROID
if (dev.isNVidia())
return false;
#endif
// build processing
String processing;
Mat kernel8u;

View File

@ -2966,6 +2966,11 @@ static bool ocl_bilateralFilter_8u(InputArray _src, OutputArray _dst, int d,
double sigma_color, double sigma_space,
int borderType)
{
#ifdef ANDROID
if (ocl::Device::getDefault().isNVidia())
return false;
#endif
int type = _src.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
int i, j, maxk, radius;

View File

@ -99,12 +99,17 @@ OCL_TEST_P(Canny, Accuracy)
generateTestData();
const double low_thresh = 50.0, high_thresh = 100.0;
double eps = 1e-2;
#ifdef ANDROID
if (cv::ocl::Device::getDefault().isNVidia())
eps = 12e-3;
#endif
OCL_OFF(cv::Canny(src_roi, dst_roi, low_thresh, high_thresh, apperture_size, useL2gradient));
OCL_ON(cv::Canny(usrc_roi, udst_roi, low_thresh, high_thresh, apperture_size, useL2gradient));
EXPECT_MAT_SIMILAR(dst_roi, udst_roi, 1e-2);
EXPECT_MAT_SIMILAR(dst, udst, 1e-2);
EXPECT_MAT_SIMILAR(dst_roi, udst_roi, eps);
EXPECT_MAT_SIMILAR(dst, udst, eps);
}
OCL_INSTANTIATE_TEST_CASE_P(ImgProc, Canny, testing::Combine(

View File

@ -128,7 +128,7 @@ OCL_TEST_P(CvtColor, BGR2GRAY) { performTest(3, 1, CVTCODE(BGR2GRAY)); }
OCL_TEST_P(CvtColor, GRAY2BGR) { performTest(1, 3, CVTCODE(GRAY2BGR)); }
OCL_TEST_P(CvtColor, RGBA2GRAY) { performTest(4, 1, CVTCODE(RGBA2GRAY)); }
OCL_TEST_P(CvtColor, GRAY2RGBA) { performTest(1, 4, CVTCODE(GRAY2RGBA)); }
OCL_TEST_P(CvtColor, BGRA2GRAY) { performTest(4, 1, CVTCODE(BGRA2GRAY)); }
OCL_TEST_P(CvtColor, BGRA2GRAY) { performTest(4, 1, CVTCODE(BGRA2GRAY), cv::ocl::Device::getDefault().isNVidia() ? 1 : 1e-3); }
OCL_TEST_P(CvtColor, GRAY2BGRA) { performTest(1, 4, CVTCODE(GRAY2BGRA)); }
// RGB <-> YUV

View File

@ -319,10 +319,17 @@ OCL_TEST_P(Remap_INTER_LINEAR, Mat)
{
random_roi();
double eps = 2.0;
#ifdef ANDROID
// TODO investigate accuracy
if (cv::ocl::Device::getDefault().isNVidia())
eps = 8.0;
#endif
OCL_OFF(cv::remap(src_roi, dst_roi, map1_roi, map2_roi, INTER_LINEAR, borderType, val));
OCL_ON(cv::remap(usrc_roi, udst_roi, umap1_roi, umap2_roi, INTER_LINEAR, borderType, val));
Near(2.0);
Near(eps);
}
}

View File

@ -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)

View File

@ -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()

View File

@ -1,4 +1,4 @@
if(IOS)
if(IOS OR WINRT)
ocv_module_disable(superres)
endif()

View File

@ -1,6 +1,6 @@
set(the_description "The ts module")
if(IOS)
if(IOS OR WINRT)
ocv_module_disable(ts)
endif()

View File

@ -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

View File

@ -458,10 +458,8 @@ CV_INLINE void
uchar nShadowDetection
)
{
int size=_src.rows*_src.cols;
int nchannels = CV_MAT_CN(_src.type());
const uchar* pDataCurrent=_src.ptr(0);
uchar* pDataOutput=_dst.ptr(0);
//model
uchar* m_aModel=_bgmodel.ptr(0);
uchar* m_nNextLongUpdate=_nNextLongUpdate.ptr(0);
@ -509,48 +507,51 @@ CV_INLINE void
if (_nLongCounter >= m_nLongUpdate) _nLongCounter = 0;
//go through the image
for (long i=0;i<size;i++)
long i = 0;
for (long y = 0; y < _src.rows; y++)
{
const uchar* data=pDataCurrent;
pDataCurrent=pDataCurrent+nchannels;
//update model+ background subtract
uchar include=0;
int result= _cvCheckPixelBackgroundNP(i, data, nchannels,
m_nN, m_aModel, m_fTb,m_nkNN, m_fTau,m_bShadowDetection,include);
_cvUpdatePixelBackgroundNP(i,data,nchannels,
m_nN, m_aModel,
m_nNextLongUpdate,
m_nNextMidUpdate,
m_nNextShortUpdate,
m_aModelIndexLong,
m_aModelIndexMid,
m_aModelIndexShort,
m_nLongCounter,
m_nMidCounter,
m_nShortCounter,
m_nLongUpdate,
m_nMidUpdate,
m_nShortUpdate,
include
);
switch (result)
for (long x = 0; x < _src.cols; x++)
{
case 0:
//foreground
(* pDataOutput)=255;
break;
case 1:
//background
(* pDataOutput)=0;
break;
case 2:
//shadow
(* pDataOutput)=nShadowDetection;
break;
const uchar* data = _src.ptr(y, x);
//update model+ background subtract
uchar include=0;
int result= _cvCheckPixelBackgroundNP(i, data, nchannels,
m_nN, m_aModel, m_fTb,m_nkNN, m_fTau,m_bShadowDetection,include);
_cvUpdatePixelBackgroundNP(i,data,nchannels,
m_nN, m_aModel,
m_nNextLongUpdate,
m_nNextMidUpdate,
m_nNextShortUpdate,
m_aModelIndexLong,
m_aModelIndexMid,
m_aModelIndexShort,
m_nLongCounter,
m_nMidCounter,
m_nShortCounter,
m_nLongUpdate,
m_nMidUpdate,
m_nShortUpdate,
include
);
switch (result)
{
case 0:
//foreground
*_dst.ptr(y, x) = 255;
break;
case 1:
//background
*_dst.ptr(y, x) = 0;
break;
case 2:
//shadow
*_dst.ptr(y, x) = nShadowDetection;
break;
}
i++;
}
pDataOutput++;
}
};

View File

@ -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()

View File

@ -135,7 +135,8 @@ enum { CAP_PROP_POS_MSEC =0,
// Currently, these are supported through the libv4l interface only.
enum { CAP_MODE_BGR = 0, // BGR24 (default)
CAP_MODE_RGB = 1, // RGB24
CAP_MODE_GRAY = 2 // Y8
CAP_MODE_GRAY = 2, // Y8
CAP_MODE_YUYV = 3 // YUYV
};

View File

@ -299,7 +299,8 @@ enum
{
CV_CAP_MODE_BGR = 0, // BGR24 (default)
CV_CAP_MODE_RGB = 1, // RGB24
CV_CAP_MODE_GRAY = 2 // Y8
CV_CAP_MODE_GRAY = 2, // Y8
CV_CAP_MODE_YUYV = 3 // YUYV
};
enum

View File

@ -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__)

View File

@ -646,6 +646,8 @@ static inline int channels_for_mode(int mode)
switch(mode) {
case CV_CAP_MODE_GRAY:
return 1;
case CV_CAP_MODE_YUYV:
return 2;
default:
return 3;
}
@ -713,31 +715,26 @@ static int _capture_V4L2 (CvCaptureCAM_V4L *capture, char *deviceName)
/* libv4l will convert from any format to V4L2_PIX_FMT_BGR24,
V4L2_PIX_FMT_RGV24, or V4L2_PIX_FMT_YUV420 */
unsigned int requestedPixelFormat;
int width;
int height;
switch (capture->mode) {
case CV_CAP_MODE_RGB:
requestedPixelFormat = V4L2_PIX_FMT_RGB24;
width = capture->width;
height = capture->height;
break;
case CV_CAP_MODE_GRAY:
requestedPixelFormat = V4L2_PIX_FMT_YUV420;
width = capture->width;
height = capture->height;
break;
case CV_CAP_MODE_YUYV:
requestedPixelFormat = V4L2_PIX_FMT_YUYV;
break;
default:
requestedPixelFormat = V4L2_PIX_FMT_BGR24;
width = capture->width;
height = capture->height;
break;
}
CLEAR (capture->form);
capture->form.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
capture->form.fmt.pix.pixelformat = requestedPixelFormat;
capture->form.fmt.pix.field = V4L2_FIELD_ANY;
capture->form.fmt.pix.width = width;
capture->form.fmt.pix.height = height;
capture->form.fmt.pix.width = capture->width;
capture->form.fmt.pix.height = capture->height;
if (-1 == xioctl (capture->deviceHandle, VIDIOC_S_FMT, &capture->form)) {
fprintf(stderr, "VIDEOIO ERROR: libv4l unable to ioctl S_FMT\n");
@ -949,6 +946,10 @@ static int _capture_V4L (CvCaptureCAM_V4L *capture, char *deviceName)
requestedVideoPalette = VIDEO_PALETTE_YUV420;
depth = 8;
break;
case CV_CAP_MODE_YUYV:
requestedVideoPalette = VIDEO_PALETTE_YUYV;
depth = 16;
break;
default:
requestedVideoPalette = VIDEO_PALETTE_RGB24;
depth = 24;
@ -1319,6 +1320,7 @@ static IplImage* icvRetrieveFrameCAM_V4L( CvCaptureCAM_V4L* capture, int) {
switch(capture->imageProperties.palette) {
case VIDEO_PALETTE_RGB24:
case VIDEO_PALETTE_YUV420:
case VIDEO_PALETTE_YUYV:
memcpy((char *)capture->frame.imageData,
(char *)(capture->memoryMap + capture->memoryBuffer.offsets[capture->bufferIndex]),
capture->frame.imageSize);
@ -1464,6 +1466,10 @@ static int icvSetVideoSize( CvCaptureCAM_V4L* capture, int w, int h) {
cropHeight = h*8;
cropWidth = w*8;
break;
case CV_CAP_MODE_YUYV:
cropHeight = h*16;
cropWidth = w*16;
break;
default:
cropHeight = h*24;
cropWidth = w*24;
@ -1719,6 +1725,7 @@ static int icvSetPropertyCAM_V4L(CvCaptureCAM_V4L* capture, int property_id, dou
case CV_CAP_MODE_BGR:
case CV_CAP_MODE_RGB:
case CV_CAP_MODE_GRAY:
case CV_CAP_MODE_YUYV:
capture->mode = mode;
/* recreate the capture buffer for the same output resolution
but a different pixel format */

View File

@ -86,7 +86,7 @@
#include <mferror.h>
#ifdef HAVE_WINRT
#ifdef WINRT
// for ComPtr usage
#include <wrl/client.h>
#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<UINT64, FrameRateMap> vd_CaptureFormats;
std::vector<MediaType> 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<videoDevice *> 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<void>* 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<void> _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<bool> 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)

View File

@ -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<ABI::Windows::Media::IMediaExtension>,
@ -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<StreamSink>();
if (pStream == nullptr) {
hr = E_OUTOFMEMORY;
@ -2940,7 +2940,7 @@ public:
{
hr = m_streams.Remove(pos, nullptr);
_ComPtr<ICustomStreamSink> spCustomSink;
#ifdef HAVE_WINRT
#ifdef WINRT
spCustomSink = static_cast<StreamSink*>(spStream.Get());
hr = S_OK;
#else
@ -3164,7 +3164,7 @@ public:
{
_ComPtr<ICustomStreamSink> spCustomSink;
HRESULT hr;
#ifdef HAVE_WINRT
#ifdef WINRT
spCustomSink = static_cast<StreamSink*>(pStream);
#else
hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf()));
@ -3187,7 +3187,7 @@ public:
{
_ComPtr<ICustomStreamSink> spCustomSink;
HRESULT hr;
#ifdef HAVE_WINRT
#ifdef WINRT
spCustomSink = static_cast<StreamSink*>(pStream);
#else
hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf()));
@ -3207,7 +3207,7 @@ public:
{
_ComPtr<ICustomStreamSink> spCustomSink;
HRESULT hr;
#ifdef HAVE_WINRT
#ifdef WINRT
spCustomSink = static_cast<StreamSink*>(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

View File

@ -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

102
platforms/winrt/readme.txt Normal file
View File

@ -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] <path-to-source>
Windows Phone 8.1 x86
cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.1 <path-to-source>
Windows Phone 8.1 ARM
cmake -G "Visual Studio 12 2013 ARM" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.1 <path-to-source>
Windows Store 8.1 x86
cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1 <path-to-source>
Windows Store 8.1 ARM
cmake -G "Visual Studio 12 2013 ARM" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1 <path-to-source>
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 <path-to-source>
Windows Phone 8.0 ARM
cmake -G "Visual Studio 12 2013 ARM" -DCMAKE_SYSTEM_NAME=WindowsPhone -DCMAKE_SYSTEM_VERSION=8.0 <path-to-source>
Windows Store 8.0 x86
cmake -G "Visual Studio 12 2013" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.0 <path-to-source>
Windows Store 8.0 ARM
cmake -G "Visual Studio 12 2013 ARM" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.0 <path-to-source>
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 ../

View File

@ -0,0 +1,2 @@
@echo off
Powershell.exe -ExecutionPolicy Unrestricted -File setup_winrt.ps1 %*

View File

@ -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 '<ocv-sources>/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: <src-dir>\bin\install\<platform>\<version>\<architecture> "
Write-Host " Example: '../install' "
Exit
}
Execute

View File

@ -18,23 +18,25 @@ src = cv2.imread(fn)
dst = cv2.Canny(src, 50, 200)
cdst = cv2.cvtColor(dst, cv2.COLOR_GRAY2BGR)
# HoughLines()
# lines = cv2.HoughLines(dst, 1, math.pi/180.0, 50, np.array([]), 0, 0)
# a,b,c = lines.shape
# for i in range(b):
# rho = lines[0][i][0]
# theta = lines[0][i][1]
# a = math.cos(theta)
# b = math.sin(theta)
# x0, y0 = a*rho, b*rho
# pt1 = ( int(x0+1000*(-b)), int(y0+1000*(a)) )
# pt2 = ( int(x0-1000*(-b)), int(y0-1000*(a)) )
# cv2.line(cdst, pt1, pt2, (0, 0, 255), 3, cv2.LINE_AA)
if True: # HoughLinesP
lines = cv2.HoughLinesP(dst, 1, math.pi/180.0, 40, np.array([]), 50, 10)
a,b,c = lines.shape
for i in range(a):
cv2.line(cdst, (lines[i][0][0], lines[i][0][1]), (lines[i][0][2], lines[i][0][3]), (0, 0, 255), 3, cv2.LINE_AA)
else: # HoughLines
lines = cv2.HoughLines(dst, 1, math.pi/180.0, 50, np.array([]), 0, 0)
a,b,c = lines.shape
for i in range(a):
rho = lines[i][0][0]
theta = lines[i][0][1]
a = math.cos(theta)
b = math.sin(theta)
x0, y0 = a*rho, b*rho
pt1 = ( int(x0+1000*(-b)), int(y0+1000*(a)) )
pt2 = ( int(x0-1000*(-b)), int(y0-1000*(a)) )
cv2.line(cdst, pt1, pt2, (0, 0, 255), 3, cv2.LINE_AA)
lines = cv2.HoughLinesP(dst, 1, math.pi/180.0, 50, np.array([]), 50, 10)
a,b,c = lines.shape
for i in range(b):
cv2.line(cdst, (lines[0][i][0], lines[0][i][1]), (lines[0][i][2], lines[0][i][3]), (0, 0, 255), 3, cv2.LINE_AA)
cv2.imshow("source", src)
cv2.imshow("detected lines", cdst)

87
samples/winrt/.gitignore vendored Normal file
View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
@ -30,71 +30,96 @@
<ProjectGuid>{C5B886A7-8300-46FF-B533-9613DE2AF637}</ProjectGuid>
<RootNamespace>SDKSample</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ProjectName>MediaCapture</ProjectName>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>8.1</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="UserMacros">
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxBundlePlatforms>x86</AppxBundlePlatforms>
<PackageCertificateThumbprint>76D64E4F88C9B7D47ACA757CDFD15D6F3AD81D92</PackageCertificateThumbprint>
<PackageCertificateKeyFile>MediaCapture_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="AdvancedCapture.xaml.h">
@ -159,152 +184,17 @@
<Image Include="assets\opencv-logo-150.png" />
<Image Include="assets\opencv-logo-30.png" />
<Image Include="Assets\splash-sdk.png" />
<Image Include="Assets\windows-sdk.png" />
<Image Include="Assets\StoreLogo.png" />
<Image Include="Assets\windows-sdk.scale-100.png">
<DeploymentContent>true</DeploymentContent>
</Image>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="MediaExtensions\OcvTransform\OcvTransform.vcxproj">
<Project>{ba69218f-da5c-4d14-a78d-21a9e4dec669}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="$(OPENCV_DIR)\bin\opencv_calib3d245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_contrib245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_core245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_features2d245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_flann245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_highgui245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_imgproc245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_legacy245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_ml245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_nonfree245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_objdetect245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_photo245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_stitching245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_superres245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_ts245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_video245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_videostab245.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
</None>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ApplicationDefinition Include="App.xaml" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AdvancedCapture.xaml.cpp" />
<ClCompile Include="App.xaml.cpp" />
<ClCompile Include="Common\LayoutAwarePage.cpp" />
<ClCompile Include="Constants.cpp" />
<ClCompile Include="Common\SuspensionManager.cpp" />
<ClCompile Include="MainPage.xaml.cpp" />
<ClCompile Include="pch.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="AdvancedCapture.xaml.h" />
<ClInclude Include="Constants.h" />
<ClInclude Include="MainPage.xaml.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="Common\LayoutAwarePage.h" />
<ClInclude Include="Common\SuspensionManager.h" />
<ClInclude Include="App.xaml.h" />
</ItemGroup>
<ItemGroup>
<Image Include="assets\opencv-logo-30.png">
<Filter>Assets</Filter>
</Image>
<Image Include="assets\opencv-logo-150.png">
<Filter>Assets</Filter>
</Image>
<Image Include="Assets\splash-sdk.png">
<Filter>Assets</Filter>
</Image>
<Image Include="Assets\StoreLogo.png">
<Filter>Assets</Filter>
</Image>
<Image Include="Assets\windows-sdk.scale-100.png" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest" />
</ItemGroup>
<ItemGroup>
<Page Include="AdvancedCapture.xaml" />
<Page Include="Common\StandardStyles.xaml" />
<Page Include="MainPage.xaml" />
<Page Include="Sample-Utils\SampleTemplateStyles.xaml" />
</ItemGroup>
<ItemGroup>
<Filter Include="Assets">
<UniqueIdentifier>{392352d8-f913-4741-82cf-d8075bb6f022}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="MediaCapture_TemporaryKey.pfx" />
</ItemGroup>
</Project>

View File

@ -7,5 +7,6 @@ namespace OcvTransform
[version(NTDDI_WIN8)]
runtimeclass OcvImageManipulations
{
interface Windows.Media.IMediaExtension;
}
}

View File

@ -8,8 +8,11 @@
#include "OcvTransform.h"
#include "bufferlock.h"
#include "opencv2\core\core.hpp"
#include "opencv2\imgproc\imgproc.hpp"
#include <opencv2\core\core.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2\features2d\features2d.hpp>
using namespace Microsoft::WRL;

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
@ -27,47 +27,48 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
<ProjectGuid>{BA69218F-DA5C-4D14-A78D-21A9E4DEC669}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>OcvTransform</RootNamespace>
<ProjectName>OcvTransform</ProjectName>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>8.1</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
@ -75,27 +76,34 @@
</PropertyGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<GenerateManifest>false</GenerateManifest>
<OutDir>$(Configuration)\$(MSBuildProjectName)\</OutDir>
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<GenerateManifest>false</GenerateManifest>
@ -123,14 +131,14 @@
</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib;opencv_core245.lib;opencv_imgproc245.lib</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>OcvTransform.def</ModuleDefinitionFile>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command>mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(ProjectDir)$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial</Command>
@ -147,14 +155,14 @@
</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>OcvTransform.def</ModuleDefinitionFile>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command>mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial</Command>
@ -171,14 +179,14 @@
</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>OcvTransform.def</ModuleDefinitionFile>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command>mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial</Command>
@ -195,14 +203,14 @@
</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>OcvTransform.def</ModuleDefinitionFile>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command>mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(ProjectDir)$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial</Command>
@ -219,14 +227,14 @@
</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>OcvTransform.def</ModuleDefinitionFile>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command>mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial</Command>
@ -243,14 +251,14 @@
</PrecompiledHeaderOutputFile>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
<CompileAsWinRT>false</CompileAsWinRT>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories);$(ProjectDir)\..\Common</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>runtimeobject.lib;%(AdditionalDependencies);mf.lib;mfuuid.lib;mfplat.lib</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<ModuleDefinitionFile>OcvTransform.def</ModuleDefinitionFile>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command>mdmerge -metadata_dir "$(WindowsSDK_MetadataPath)" -o "$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)" -i "$(MSBuildProjectDirectory)" -v -partial</Command>
@ -316,4 +324,4 @@
</Target>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<OpenCV_Bin>$(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\bin\</OpenCV_Bin>
<OpenCV_Lib>$(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\lib\</OpenCV_Lib>
<OpenCV_Include>$(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\include\</OpenCV_Include>
<!--debug suffix for OpenCV dlls and libs -->
<DebugSuffix Condition="'$(Configuration)'=='Debug'">d</DebugSuffix>
<DebugSuffix Condition="'$(Configuration)'!='Debug'"></DebugSuffix>
</PropertyGroup>
<ItemGroup>
<!--Add required OpenCV dlls here-->
<None Include="$(OpenCV_Bin)opencv_core300$(DebugSuffix).dll">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(OpenCV_Bin)opencv_imgproc300$(DebugSuffix).dll">
<DeploymentContent>true</DeploymentContent>
</None>
</ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(OpenCV_Include);$(ProjectDir)\..\Common;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<!--Add required OpenCV libs here-->
<AdditionalDependencies>opencv_core300$(DebugSuffix).lib;opencv_imgproc300$(DebugSuffix).lib;runtimeobject.lib;mf.lib;mfuuid.lib;mfplat.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OpenCV_Lib);%(AdditionalLibraryDirectories);</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
</Project>

View File

@ -1,24 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="Microsoft.SDKSamples.MediaCapture.CPP" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="1.0.0.0" />
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<Identity Name="Microsoft.SDKSamples.MediaCapture.CPP" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="1.1.0.6" />
<Properties>
<DisplayName>MediaCapture CPP sample</DisplayName>
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
<Logo>Assets\storeLogo-sdk.png</Logo>
<Logo>Assets\windows-sdk.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
<OSMinVersion>6.3</OSMinVersion>
<OSMaxVersionTested>6.3</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="MediaCapture.App" Executable="$targetnametoken$.exe" EntryPoint="MediaCapture.App">
<VisualElements DisplayName="OCV Image Manipulations" Logo="assets\opencv-logo-150.png" SmallLogo="assets\opencv-logo-30.png" Description="OpenCV Image Manipulations sample" ForegroundText="light" BackgroundColor="#00b2f0">
<DefaultTile ShortName="Ocv ImageManipulations" ShowName="allLogos" />
<SplashScreen Image="Assets\splash-sdk.png" BackgroundColor="#00b2f0" />
</VisualElements>
<m2:VisualElements DisplayName="OCV Image Manipulations" Description="OpenCV Image Manipulations sample" BackgroundColor="#00b2f0" ForegroundText="light" Square150x150Logo="Assets\opencv-logo-150.png" Square30x30Logo="Assets\opencv-logo-30.png">
<m2:DefaultTile ShortName="Ocv ImageManipulations">
<m2:ShowNameOnTiles>
<m2:ShowOn Tile="square150x150Logo" />
</m2:ShowNameOnTiles>
</m2:DefaultTile>
<m2:SplashScreen BackgroundColor="#00b2f0" Image="Assets\splash-sdk.png" />
</m2:VisualElements>
</Application>
</Applications>
<Capabilities>
@ -33,4 +37,4 @@
</InProcessServer>
</Extension>
</Extensions>
</Package>
</Package>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<OpenCV_Bin>$(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\bin\</OpenCV_Bin>
<OpenCV_Lib>$(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\lib\</OpenCV_Lib>
<OpenCV_Include>$(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\include\</OpenCV_Include>
<!--debug suffix for OpenCV dlls and libs -->
<DebugSuffix Condition="'$(Configuration)'=='Debug'">d</DebugSuffix>
<DebugSuffix Condition="'$(Configuration)'!='Debug'"></DebugSuffix>
</PropertyGroup>
<ItemGroup>
<!--Add required OpenCV dlls here-->
<None Include="$(OpenCV_Bin)opencv_core300$(DebugSuffix).dll">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(OpenCV_Bin)opencv_imgproc300$(DebugSuffix).dll">
<DeploymentContent>true</DeploymentContent>
</None>
</ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(OpenCV_Include);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<!--Add required OpenCV libs here-->
<AdditionalDependencies>opencv_core300$(DebugSuffix).lib;opencv_imgproc300$(DebugSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OpenCV_Lib);%(AdditionalLibraryDirectories);</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
</Project>

View File

@ -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

View File

@ -9,6 +9,8 @@
#include <wrl\client.h>
#include <Robuffer.h>
#include <vector>
#include <opencv2\imgproc\types_c.h>
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<cv::FeatureDetector> detector = cv::FastFeatureDetector::create(50);
cv::Ptr<cv::FastFeatureDetector> detector = cv::FastFeatureDetector::create(50);
std::vector<cv::KeyPoint> features;
image.copyTo(result);

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
@ -30,115 +30,89 @@
<ProjectGuid>{a5555ea2-f9e8-4078-90f5-d428f2c0d6d1}</ProjectGuid>
<RootNamespace>OcvImageProcessing</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>8.1</ApplicationTypeRevision>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="opencv.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<PackageCertificateKeyFile>OcvImageProcessing_TemporaryKey.pfx</PackageCertificateKeyFile>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxBundlePlatforms>x86</AppxBundlePlatforms>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>opencv_core247d.lib;opencv_imgproc247d.lib;opencv_features2d247d.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(OPENCV_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>opencv_core247.lib;opencv_imgproc247.lib;opencv_features2d247.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="App.xaml.h">
@ -163,105 +137,6 @@
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="$(OPENCV_DIR)\bin\opencv_calib3d247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_calib3d247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_contrib247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_contrib247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_core247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_core247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_features2d247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_features2d247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_flann247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_flann247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_gpu247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_highgui247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_highgui247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_imgproc247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_imgproc247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_legacy247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_legacy247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_ml247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_ml247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_nonfree247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_nonfree247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_objdetect247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_objdetect247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_photo247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_photo247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_stitching247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_stitching247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_superres247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_superres247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_video247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_video247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_videostab247.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
</None>
<None Include="$(OPENCV_DIR)\bin\opencv_videostab247d.dll">
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
</None>
<None Include="OcvImageProcessing_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>

View File

@ -41,39 +41,6 @@
</ItemGroup>
<ItemGroup>
<None Include="OcvImageProcessing_TemporaryKey.pfx" />
<None Include="$(OPENCV_DIR)\bin\opencv_calib3d247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_calib3d247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_contrib247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_contrib247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_core247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_core247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_features2d247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_features2d247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_flann247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_flann247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_gpu247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_highgui247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_highgui247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_imgproc247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_imgproc247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_legacy247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_legacy247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_ml247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_ml247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_nonfree247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_nonfree247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_objdetect247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_objdetect247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_photo247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_photo247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_stitching247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_stitching247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_superres247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_superres247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_video247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_video247d.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_videostab247.dll" />
<None Include="$(OPENCV_DIR)\bin\opencv_videostab247d.dll" />
</ItemGroup>
<ItemGroup>
<Page Include="MainPage.xaml" />

View File

@ -1,24 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="96635370-3751-48a8-84a6-afd4229cf435" Publisher="CN=asmorkalov" Version="1.0.0.0" />
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<Identity Name="96635370-3751-48a8-84a6-afd4229cf435" Publisher="CN=dalestam" Version="1.1.0.1" />
<Properties>
<DisplayName>OcvImageProcessing</DisplayName>
<PublisherDisplayName>asmorkalov</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
<OSMinVersion>6.3</OSMinVersion>
<OSMaxVersionTested>6.3</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="OcvImageProcessing.App">
<VisualElements DisplayName="OcvImageProcessing" Logo="Assets\Logo.png" SmallLogo="Assets\SmallLogo.png" Description="OcvImageProcessing" ForegroundText="light" BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
<m2:VisualElements DisplayName="OcvImageProcessing" Description="OcvImageProcessing" BackgroundColor="#464646" ForegroundText="light" Square150x150Logo="Assets\Logo.png" Square30x30Logo="Assets\SmallLogo.png">
<m2:DefaultTile>
<m2:ShowNameOnTiles>
<m2:ShowOn Tile="square150x150Logo" />
</m2:ShowNameOnTiles>
</m2:DefaultTile>
<m2:SplashScreen Image="Assets\SplashScreen.png" />
</m2:VisualElements>
</Application>
</Applications>
</Package>

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<OpenCV_Bin>$(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\bin\</OpenCV_Bin>
<OpenCV_Lib>$(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\$(PlatformTarget)\vc12\lib\</OpenCV_Lib>
<OpenCV_Include>$(OPENCV_WINRT_INSTALL_DIR)WS\8.1\$(PlatformTarget)\include\</OpenCV_Include>
<!--debug suffix for OpenCV dlls and libs -->
<DebugSuffix Condition="'$(Configuration)'=='Debug'">d</DebugSuffix>
<DebugSuffix Condition="'$(Configuration)'!='Debug'"></DebugSuffix>
</PropertyGroup>
<ItemGroup>
<!--Add required OpenCV dlls here-->
<None Include="$(OpenCV_Bin)opencv_core300$(DebugSuffix).dll">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(OpenCV_Bin)opencv_imgproc300$(DebugSuffix).dll">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(OpenCV_Bin)opencv_features2d300$(DebugSuffix).dll">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(OpenCV_Bin)opencv_flann300$(DebugSuffix).dll">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="$(OpenCV_Bin)opencv_ml300$(DebugSuffix).dll">
<DeploymentContent>true</DeploymentContent>
</None>
</ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(OpenCV_Include);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<!--Add required OpenCV libs here-->
<AdditionalDependencies>opencv_core300$(DebugSuffix).lib;opencv_imgproc300$(DebugSuffix).lib;opencv_features2d300$(DebugSuffix).lib;opencv_flann300$(DebugSuffix).lib;opencv_ml300$(DebugSuffix).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OpenCV_Lib);%(AdditionalLibraryDirectories);</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
</Project>

6
samples/winrt/readme.txt Normal file
View File

@ -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.

87
samples/winrt_universal/.gitignore vendored Normal file
View File

@ -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

View File

@ -0,0 +1,7 @@
<Application
x:Class="PhoneTutorial.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PhoneTutorial">
</Application>

View File

@ -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
/// <summary>
/// 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().
/// </summary>
App::App()
{
InitializeComponent();
Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
}
/// <summary>
/// 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.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
void App::OnLaunched(LaunchActivatedEventArgs^ e)
{
#if _DEBUG
if (IsDebuggerPresent())
{
DebugSettings->EnableFrameRateCounter = true;
}
#endif
auto rootFrame = dynamic_cast<Frame^>(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();
}
/// <summary>
/// Restores the content transitions after the app has launched.
/// </summary>
void App::RootFrame_FirstNavigated(Object^ sender, NavigationEventArgs^ e)
{
auto rootFrame = safe_cast<Frame^>(sender);
TransitionCollection^ newTransitions;
if (_transitions == nullptr)
{
newTransitions = ref new TransitionCollection();
newTransitions->Append(ref new NavigationThemeTransition());
}
else
{
newTransitions = _transitions;
}
rootFrame->ContentTransitions = newTransitions;
rootFrame->Navigated -= _firstNavigatedToken;
}
/// <summary>
/// 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.
/// </summary>
void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
{
(void) sender; // Unused parameter
(void) e; // Unused parameter
// TODO: Save application state and stop any background activity
}

View File

@ -0,0 +1,29 @@
//
// App.xaml.h
// Declaration of the App class.
//
#pragma once
#include "App.g.h"
namespace PhoneTutorial
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
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);
};
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 KiB

View File

@ -0,0 +1,17 @@
<Page
x:Class="PhoneTutorial.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PhoneTutorial"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
<StackPanel>
<Image x:Name="image" />
<Button x:Name="Process" Content="Process" HorizontalAlignment="Center" Click="Process_Click"/>
<Button x:Name="Reset" Content="Reset" HorizontalAlignment="Center" Click="Reset_Click"/>
</StackPanel>
</Grid>
</Page>

View File

@ -0,0 +1,122 @@
//
// MainPage.xaml.cpp
// Implementation of the MainPage class.
//
#include "pch.h"
#include "MainPage.xaml.h"
#include <opencv2\imgproc\types_c.h>
#include <opencv2\core\core.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <Robuffer.h>
#include <ppl.h>
#include <ppltasks.h>
using namespace PhoneTutorial;
using namespace Platform;
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::Media;
using namespace Windows::UI::Xaml::Navigation;
using namespace Windows::UI::Xaml::Media::Imaging;
using namespace Windows::Storage::Streams;
using namespace Microsoft::WRL;
using namespace Windows::ApplicationModel;
MainPage::MainPage()
{
InitializeComponent();
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
{
(void) e; // Unused parameter
LoadImage();
}
inline void ThrowIfFailed(HRESULT hr)
{
if (FAILED(hr))
{
throw Exception::CreateException(hr);
}
}
byte* GetPointerToPixelData(IBuffer^ buffer)
{
// Cast to Object^, then to its underlying IInspectable interface.
Object^ obj = buffer;
ComPtr<IInspectable> insp(reinterpret_cast<IInspectable*>(obj));
// Query the IBufferByteAccess interface.
ComPtr<IBufferByteAccess> bufferByteAccess;
ThrowIfFailed(insp.As(&bufferByteAccess));
// Retrieve the buffer data.
byte* pixels = nullptr;
ThrowIfFailed(bufferByteAccess->Buffer(&pixels));
return pixels;
}
void PhoneTutorial::MainPage::Process_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
(void) e; // Unused parameter
// get the pixels from the WriteableBitmap
byte* pPixels = GetPointerToPixelData(m_bitmap->PixelBuffer);
int height = m_bitmap->PixelHeight;
int width = m_bitmap->PixelWidth;
// create a matrix the size and type of the image
cv::Mat mat(width, height, CV_8UC4);
memcpy(mat.data, pPixels, 4 * height*width);
// convert to grayscale
cv::Mat intermediateMat;
cv::cvtColor(mat, intermediateMat, CV_RGB2GRAY);
// convert to BGRA
cv::cvtColor(intermediateMat, mat, CV_GRAY2BGRA);
// copy processed image back to the WriteableBitmap
memcpy(pPixels, mat.data, 4 * height*width);
// update the WriteableBitmap
m_bitmap->Invalidate();
}
void PhoneTutorial::MainPage::LoadImage()
{
Concurrency::task<Windows::Storage::StorageFile^> getFileTask(Package::Current->InstalledLocation->GetFileAsync(L"Lena.png"));
auto getStreamTask = getFileTask.then(
[](Windows::Storage::StorageFile ^storageFile)
{
return storageFile->OpenReadAsync();
});
getStreamTask.then(
[this](Windows::Storage::Streams::IRandomAccessStreamWithContentType^ stream)
{
m_bitmap = ref new Windows::UI::Xaml::Media::Imaging::WriteableBitmap(1, 1);
m_bitmap->SetSource(stream);
image->Source = m_bitmap;
});
}
void PhoneTutorial::MainPage::Reset_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
(void) e; // Unused parameter
LoadImage();
}

Some files were not shown because too many files have changed in this diff Show More