Browse Source

Added option to run FaceAndLandmarkDetector in BuildInfo project if swap out mini runtime with full runtime.

pull/768/merge
Canming Huang 1 year ago
parent
commit
0a7c685169
  1. 4
      Emgu.CV.Example/MAUI/BuildInfo/BuildInfo.csproj
  2. 8
      Emgu.CV.Example/MAUI/BuildInfo/MainPage.xaml
  3. 27
      Emgu.CV.Example/MAUI/BuildInfo/MainPage.xaml.cs
  4. BIN
      Emgu.CV.Example/MAUI/BuildInfo/Resources/Raw/lena.jpg

4
Emgu.CV.Example/MAUI/BuildInfo/BuildInfo.csproj

@ -50,6 +50,10 @@
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<None Remove="Resources\Raw\lena.jpg" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Emgu.CV.runtime.maui.mini" Version="4.8.1.5350" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.10" />

8
Emgu.CV.Example/MAUI/BuildInfo/MainPage.xaml

@ -30,10 +30,10 @@
HorizontalOptions="Center" />
<Button
x:Name="CounterBtn"
Text="Click me"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnCounterClicked"
x:Name="FaceDetectBtn"
Text="Run Face Detection"
SemanticProperties.Hint="Click to perform face detection"
Clicked="OnFaceDetectClicked"
HorizontalOptions="Center" />
</VerticalStackLayout>

27
Emgu.CV.Example/MAUI/BuildInfo/MainPage.xaml.cs

@ -1,4 +1,7 @@
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Models;
using Emgu.CV.Platform.Maui.UI;
namespace BuildInfo;
@ -10,11 +13,31 @@ public partial class MainPage : ContentPage
InitializeComponent();
Emgu.CV.Platform.Maui.MauiInvoke.Init();
#if DEBUG
CvInvoke.LogLevel = LogLevel.Verbose; //LogLevel.Debug;
#endif
DetailLabel.Text = CvInvoke.BuildInformation;
//If you swap out the mini runtime nuget package with the full runtime package, you will be able to test Face Landmark detection using DNN module.
var openCVConfigDict = CvInvoke.ConfigDict;
bool haveDNN = (openCVConfigDict["HAVE_OPENCV_DNN"] != 0);
FaceDetectBtn.IsVisible = haveDNN;
}
private void OnCounterClicked(object sender, EventArgs e)
private async void OnFaceDetectClicked(object sender, EventArgs e)
{
DetailLabel.Text = CvInvoke.BuildInformation;
PermissionStatus status = await Permissions.CheckStatusAsync<Permissions.Camera>();
ProcessAndRenderPage faceLandmarkDetectionPage = new ProcessAndRenderPage(
new FaceAndLandmarkDetector(),
"Perform Face Landmark Detection",
"lena.jpg",
"");
await this.Navigation.PushAsync(faceLandmarkDetectionPage);
}
}

BIN
Emgu.CV.Example/MAUI/BuildInfo/Resources/Raw/lena.jpg

After

Width: 512  |  Height: 512  |  Size: 90 KiB

Loading…
Cancel
Save