diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln b/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln
new file mode 100644
index 000000000..11bf904bc
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing.sln
@@ -0,0 +1,38 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OcvImageProcessing", "OcvImageProcessing\OcvImageProcessing.vcxproj", "{A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
+ Release|ARM = Release|ARM
+ Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|ARM.ActiveCfg = Debug|ARM
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|ARM.Build.0 = Debug|ARM
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|ARM.Deploy.0 = Debug|ARM
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|Win32.Build.0 = Debug|Win32
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|Win32.Deploy.0 = Debug|Win32
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|x64.ActiveCfg = Debug|x64
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|x64.Build.0 = Debug|x64
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Debug|x64.Deploy.0 = Debug|x64
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|ARM.ActiveCfg = Release|ARM
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|ARM.Build.0 = Release|ARM
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|ARM.Deploy.0 = Release|ARM
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|Win32.ActiveCfg = Release|Win32
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|Win32.Build.0 = Release|Win32
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|Win32.Deploy.0 = Release|Win32
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|x64.ActiveCfg = Release|x64
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|x64.Build.0 = Release|x64
+ {A5555EA2-F9E8-4078-90F5-D428F2C0D6D1}.Release|x64.Deploy.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml
new file mode 100644
index 000000000..253dba4e3
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.cpp b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.cpp
new file mode 100644
index 000000000..ce383cf34
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.cpp
@@ -0,0 +1,107 @@
+//
+// App.xaml.cpp
+// Implementation of the App class.
+//
+
+#include "pch.h"
+#include "MainPage.xaml.h"
+
+using namespace OcvImageProcessing;
+
+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::Navigation;
+
+// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
+
+///
+/// Initializes the singleton application object. This is the first line of authored code
+/// executed, and as such is the logical equivalent of main() or WinMain().
+///
+App::App()
+{
+ InitializeComponent();
+ Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
+}
+
+///
+/// Invoked when the application is launched normally by the end user. Other entry points
+/// will be used when the application is launched to open a specific file, to display
+/// search results, and so forth.
+///
+/// Details about the launch request and process.
+void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ args)
+{
+ auto rootFrame = dynamic_cast(Window::Current->Content);
+
+ // Do not repeat app initialization when the Window already has content,
+ // just ensure that the window is active
+ if (rootFrame == nullptr)
+ {
+ // Create a Frame to act as the navigation context and associate it with
+ // a SuspensionManager key
+ rootFrame = ref new Frame();
+
+ if (args->PreviousExecutionState == ApplicationExecutionState::Terminated)
+ {
+ // TODO: Restore the saved session state only when appropriate, scheduling the
+ // final launch steps after the restore is complete
+
+ }
+
+ if (rootFrame->Content == nullptr)
+ {
+ // 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(TypeName(MainPage::typeid), args->Arguments))
+ {
+ throw ref new FailureException("Failed to create initial page");
+ }
+ }
+ // Place the frame in the current Window
+ Window::Current->Content = rootFrame;
+ // Ensure the current window is active
+ Window::Current->Activate();
+ }
+ else
+ {
+ if (rootFrame->Content == nullptr)
+ {
+ // 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(TypeName(MainPage::typeid), args->Arguments))
+ {
+ throw ref new FailureException("Failed to create initial page");
+ }
+ }
+ // Ensure the current window is active
+ Window::Current->Activate();
+ }
+}
+
+///
+/// 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.
+///
+/// The source of the suspend request.
+/// Details about the suspend request.
+void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e)
+{
+ (void) sender; // Unused parameter
+ (void) e; // Unused parameter
+
+ //TODO: Save application state and stop any background activity
+}
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.h b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.h
new file mode 100644
index 000000000..2004513df
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/App.xaml.h
@@ -0,0 +1,24 @@
+//
+// App.xaml.h
+// Declaration of the App class.
+//
+
+#pragma once
+
+#include "App.g.h"
+
+namespace OcvImageProcessing
+{
+ ///
+ /// Provides application-specific behavior to supplement the default Application class.
+ ///
+ ref class App sealed
+ {
+ public:
+ App();
+ virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ args) override;
+
+ private:
+ void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e);
+ };
+}
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Lena.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Lena.png
new file mode 100644
index 000000000..3e8668734
Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Lena.png differ
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Logo.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Logo.png
new file mode 100644
index 000000000..e26771cb3
Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/Logo.png differ
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SmallLogo.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SmallLogo.png
new file mode 100644
index 000000000..1eb0d9d52
Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SmallLogo.png differ
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SplashScreen.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SplashScreen.png
new file mode 100644
index 000000000..c951e031b
Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/SplashScreen.png differ
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/StoreLogo.png b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/StoreLogo.png
new file mode 100644
index 000000000..dcb672712
Binary files /dev/null and b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Assets/StoreLogo.png differ
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Common/StandardStyles.xaml b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Common/StandardStyles.xaml
new file mode 100644
index 000000000..85f4ed640
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Common/StandardStyles.xaml
@@ -0,0 +1,1829 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Mouse
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml
new file mode 100644
index 000000000..0e49948f0
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.cpp b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.cpp
new file mode 100644
index 000000000..85f18c017
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.cpp
@@ -0,0 +1,108 @@
+//
+// MainPage.xaml.cpp
+// Implementation of the MainPage class.
+//
+
+#include "pch.h"
+#include "MainPage.xaml.h"
+#include
+#include
+#include
+using namespace OcvImageProcessing;
+
+using namespace Microsoft::WRL;
+using namespace concurrency;
+using namespace Platform;
+using namespace Windows::Foundation;
+using namespace Windows::Storage::Streams;
+using namespace Windows::UI::Xaml::Media::Imaging;
+using namespace Windows::Graphics::Imaging;
+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;
+
+#include
+#include
+
+Uri^ InputImageUri = ref new Uri(L"ms-appx:///Assets/Lena.png");
+
+// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
+
+MainPage::MainPage()
+{
+ InitializeComponent();
+}
+
+///
+/// Invoked when this page is about to be displayed in a Frame.
+///
+/// Event data that describes how this page was reached. The Parameter
+/// property is typically used to configure the page.
+void MainPage::OnNavigatedTo(NavigationEventArgs^ e)
+{
+ (void) e; // Unused parameter
+}
+
+
+void OcvImageProcessing::MainPage::Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
+{
+ RandomAccessStreamReference^ streamRef = RandomAccessStreamReference::CreateFromUri(InputImageUri);
+
+ task (streamRef->OpenReadAsync()).
+ then([](task thisTask)
+ {
+ IRandomAccessStreamWithContentType^ fileStream = thisTask.get();
+ return BitmapDecoder::CreateAsync(fileStream);
+ }).
+ then([](task thisTask)
+ {
+ BitmapDecoder^ decoder = thisTask.get();
+ return decoder->GetFrameAsync(0);
+ }).
+ then([this](task thisTask)
+ {
+ BitmapFrame^ frame = thisTask.get();
+
+ // Save some information as fields
+ frameWidth = frame->PixelWidth;
+ frameHeight = frame->PixelHeight;
+
+ return frame->GetPixelDataAsync();
+ }).
+ then([this](task thisTask)
+ {
+ PixelDataProvider^ pixelProvider = thisTask.get();
+ Platform::Array^ srcPixels = pixelProvider->DetachPixelData();
+
+ cv::Mat inputImage(frameHeight, frameWidth, CV_8UC4, srcPixels->Data);
+ unsigned char* dstPixels;
+
+ // Create the WriteableBitmap
+ WriteableBitmap^ bitmap = ref new WriteableBitmap(frameWidth, frameHeight);
+
+ // Get access to the pixels
+ IBuffer^ buffer = bitmap->PixelBuffer;
+
+ // Obtain IBufferByteAccess
+ ComPtr pBufferByteAccess;
+ ComPtr pBuffer((IUnknown*)buffer);
+ pBuffer.As(&pBufferByteAccess);
+
+ // Get pointer to pixel bytes
+ pBufferByteAccess->Buffer(&dstPixels);
+ cv::Mat outputImage(frameHeight, frameWidth, CV_8UC4, dstPixels);
+
+ cv::Mat intermediateMat;
+ cv::Canny(inputImage, intermediateMat, 80, 90);
+ cv::cvtColor(intermediateMat, outputImage, CV_GRAY2BGRA);
+ //cv::blur(inputImage, outputImage, cv::Size(3,3));
+
+ // Set the bitmap to the Image element
+ PreviewWidget->Source = bitmap;
+ });
+}
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.h b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.h
new file mode 100644
index 000000000..846662105
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.h
@@ -0,0 +1,27 @@
+//
+// MainPage.xaml.h
+// Declaration of the MainPage class.
+//
+
+#pragma once
+
+#include "MainPage.g.h"
+
+namespace OcvImageProcessing
+{
+ ///
+ /// An empty page that can be used on its own or navigated to within a Frame.
+ ///
+ public ref class MainPage sealed
+ {
+ public:
+ MainPage();
+
+ protected:
+ virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override;
+ private:
+ void Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
+
+ unsigned int frameWidth, frameHeight;
+ };
+}
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj
new file mode 100644
index 000000000..b85d9cfb1
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj
@@ -0,0 +1,200 @@
+
+
+
+
+ Debug
+ ARM
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ ARM
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {a5555ea2-f9e8-4078-90f5-d428f2c0d6d1}
+ OcvImageProcessing
+ en-US
+ 11.0
+ true
+
+
+
+ Application
+ true
+ v110
+
+
+ Application
+ true
+ v110
+
+
+ Application
+ true
+ v110
+
+
+ Application
+ false
+ true
+ v110
+
+
+ Application
+ false
+ true
+ v110
+
+
+ Application
+ false
+ true
+ v110
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OcvImageProcessing_TemporaryKey.pfx
+
+
+
+ /bigobj %(AdditionalOptions)
+ 4453
+
+
+
+
+ /bigobj %(AdditionalOptions)
+ 4453
+
+
+
+
+ /bigobj %(AdditionalOptions)
+ 4453
+ C:\Users\asmorkalov\Projects\opencv\build\install\include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+
+
+ C:\Users\asmorkalov\Projects\opencv\build\install\lib;%(AdditionalLibraryDirectories)
+ opencv_core246.lib;opencv_imgproc246.lib;%(AdditionalDependencies)
+
+
+
+
+ /bigobj %(AdditionalOptions)
+ 4453
+ C:\Users\asmorkalov\Projects\opencv\build\install\include;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+
+
+ C:\Users\asmorkalov\Projects\opencv\build\install\lib;%(AdditionalLibraryDirectories)
+
+
+
+
+ /bigobj %(AdditionalOptions)
+ 4453
+
+
+
+
+ /bigobj %(AdditionalOptions)
+ 4453
+
+
+
+
+
+ App.xaml
+
+
+ MainPage.xaml
+
+
+
+
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+
+
+ Designer
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+ App.xaml
+
+
+ MainPage.xaml
+
+
+ Create
+ Create
+ Create
+ Create
+ Create
+ Create
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj.filters b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj.filters
new file mode 100644
index 000000000..0004d0c7e
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/OcvImageProcessing.vcxproj.filters
@@ -0,0 +1,55 @@
+
+
+
+
+ a5555ea2-f9e8-4078-90f5-d428f2c0d6d1
+
+
+ 714bc2d8-fb65-4062-80fa-4d1822fe24e2
+
+
+ Common
+
+
+ Assets
+
+
+ Assets
+
+
+ Assets
+
+
+ Assets
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Assets
+
+
+
\ No newline at end of file
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/Package.appxmanifest b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Package.appxmanifest
new file mode 100644
index 000000000..d888e4f3e
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/Package.appxmanifest
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ OcvImageProcessing
+ asmorkalov
+ Assets\StoreLogo.png
+
+
+
+ 6.2.1
+ 6.2.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/pch.cpp b/samples/winrt/OcvImageProcessing/OcvImageProcessing/pch.cpp
new file mode 100644
index 000000000..01484ff5a
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/pch.cpp
@@ -0,0 +1,6 @@
+//
+// pch.cpp
+// Include the standard header and generate the precompiled header.
+//
+
+#include "pch.h"
diff --git a/samples/winrt/OcvImageProcessing/OcvImageProcessing/pch.h b/samples/winrt/OcvImageProcessing/OcvImageProcessing/pch.h
new file mode 100644
index 000000000..fadf910de
--- /dev/null
+++ b/samples/winrt/OcvImageProcessing/OcvImageProcessing/pch.h
@@ -0,0 +1,9 @@
+//
+// pch.h
+// Header for standard system include files.
+//
+
+#pragma once
+
+#include
+#include "App.xaml.h"