Browse Source

Updated UWP project nuget dependencies.

pull/262/head
Canming Huang 6 years ago
parent
commit
b2e28805ce
  1. 49
      Emgu.CV.Example/RealtimeCamera.UWP/MainPage.xaml.cs
  2. 3
      Emgu.CV.Example/RealtimeCamera.UWP/Package.appxmanifest
  3. 8
      Emgu.CV.Example/RealtimeCamera.UWP/Properties/AssemblyInfo.cs
  4. 10
      Emgu.CV.Example/RealtimeCamera.UWP/RealtimeCamera.csproj
  5. 4
      Emgu.CV.Example/XamarinForms/UWP/XamarinForms.UWP.csproj

49
Emgu.CV.Example/RealtimeCamera.UWP/MainPage.xaml.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
@ -45,7 +46,8 @@ namespace RealtimeCamera
}
private IntrinsicCameraParameters p;
private Mat _cameraMatrix;
private Mat _distCoeffs;
private Matrix<float> mapx, mapy;
private VideoCapture _capture;
@ -68,27 +70,50 @@ namespace RealtimeCamera
//Note that m is in 3 channel RGB color space,
//our default color space is BGR for 3 channel Mat
_capture.Read(m);
CvInvoke.WinrtImshow();
if (!m.IsEmpty)
{
if (p == null)
if (_cameraMatrix == null || _distCoeffs == null)
{
//Create a dummy camera calibration matrix for testing
//Use your own if you have calibrated your camera
p = new IntrinsicCameraParameters(5);
_cameraMatrix = new Mat(new System.Drawing.Size(3, 3), DepthType.Cv32F, 1);
int centerY = m.Width >> 1;
int centerX = m.Height >> 1;
CvInvoke.SetIdentity(p.IntrinsicMatrix, new MCvScalar(1.0));
p.IntrinsicMatrix.Data[0, 2] = centerY;
p.IntrinsicMatrix.Data[1, 2] = centerX;
p.IntrinsicMatrix.Data[2, 2] = 1;
p.DistortionCoeffs.Data[0, 0] = -0.000003;
p.InitUndistortMap(m.Width, m.Height, out mapx, out mapy);
//CvInvoke.SetIdentity(_cameraMatrix, new MCvScalar(1.0));
_cameraMatrix.SetTo(new double[]
{
1, 0, centerY,
0, 1, centerX,
0, 0, 1
});
_distCoeffs = new Mat(new System.Drawing.Size(5, 1), DepthType.Cv32F, 1);
_distCoeffs.SetTo(new double[] { -0.000003, 0, 0, 0, 0 });
mapx = new Matrix<float>(m.Height, m.Width);
mapy = new Matrix<float>(m.Height, m.Width);
CvInvoke.InitUndistortRectifyMap(
_cameraMatrix,
_distCoeffs,
null,
_cameraMatrix,
m.Size,
DepthType.Cv32F,
mapx,
mapy);
//p.IntrinsicMatrix.Data[0, 2] = centerY;
//p.IntrinsicMatrix.Data[1, 2] = centerX;
//p.IntrinsicMatrix.Data[2, 2] = 1;
//p.DistortionCoeffs.Data[0, 0] = -0.000003;
//p.InitUndistortMap(m.Width, m.Height, out mapx, out mapy);
}
m.CopyTo(mProcessed);
CvInvoke.Undistort(m, mProcessed, p.IntrinsicMatrix, p.DistortionCoeffs );
CvInvoke.Undistort(m, mProcessed, _cameraMatrix, _distCoeffs );
//mProcess is in the same color space as m, which is RGB,
//needed to change to BGR
@ -98,7 +123,7 @@ namespace RealtimeCamera
//Can apply simple image processing to the captured image, let just invert the pixels
//CvInvoke.BitwiseNot(m, m);
//render the processed image on the top imageview
//render the processed image on the top image view
CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
async () =>
{

3
Emgu.CV.Example/RealtimeCamera.UWP/Package.appxmanifest

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap6="http://schemas.microsoft.com/appx/manifest/uap/windows10/6" IgnorableNamespaces="uap mp uap6">
<Identity Name="be6590a5-8b08-4a76-9b94-61405f7f8926" Publisher="CN=canming" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="be6590a5-8b08-4a76-9b94-61405f7f8926" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
@ -26,6 +26,7 @@
<Capability Name="internetClient" />
<uap:Capability Name="videosLibrary" />
<uap:Capability Name="picturesLibrary" />
<uap6:Capability Name="graphicsCapture" />
<DeviceCapability Name="webcam" />
</Capabilities>
</Package>

8
Emgu.CV.Example/RealtimeCamera.UWP/Properties/AssemblyInfo.cs

@ -7,12 +7,6 @@ using System.Runtime.InteropServices;
// associated with an assembly.
[assembly: AssemblyTitle("RealtimeCamera")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RealtimeCamera")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
@ -24,6 +18,4 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

10
Emgu.CV.Example/RealtimeCamera.UWP/RealtimeCamera.csproj

@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.15063.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@ -89,6 +89,9 @@
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\CommonAssemblyInfo.cs">
<Link>CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
@ -125,7 +128,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.1.9</Version>
<Version>6.2.8</Version>
</PackageReference>
<PackageReference Include="System.Drawing.Primitives">
<Version>4.3.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="..\..\Emgu.CV\Emgu.CV.projitems" Label="Shared" />

4
Emgu.CV.Example/XamarinForms/UWP/XamarinForms.UWP.csproj

@ -160,13 +160,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.1.9</Version>
<Version>6.2.8</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.Media">
<Version>4.0.1.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms">
<Version>3.5.0.169047</Version>
<Version>3.6.0.293080</Version>
</PackageReference>
</ItemGroup>
<Import Project="..\..\..\Emgu.CV\Emgu.CV.projitems" Label="Shared" />

Loading…
Cancel
Save