From d0bbbe48958455fcde8ecc300cfab50198eb813a Mon Sep 17 00:00:00 2001 From: Speykious Date: Wed, 2 Feb 2022 17:19:56 +0100 Subject: [PATCH] Let examples use the new safe constructor --- Mediapipe.Net.Examples.FaceMesh/Program.cs | 8 ++------ Mediapipe.Net.Examples.FaceMeshGpu/Program.cs | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Mediapipe.Net.Examples.FaceMesh/Program.cs b/Mediapipe.Net.Examples.FaceMesh/Program.cs index f7ecab06..211c8f92 100644 --- a/Mediapipe.Net.Examples.FaceMesh/Program.cs +++ b/Mediapipe.Net.Examples.FaceMesh/Program.cs @@ -71,12 +71,8 @@ private static unsafe void onFrame(object? sender, FrameEventArgs e) Frame cFrame = converter.Convert(frame); - ImageFrame imgframe; - fixed (byte* rawDataPtr = cFrame.RawData) - { - imgframe = new ImageFrame(ImageFormat.Srgba, - cFrame.Width, cFrame.Height, cFrame.WidthStep, rawDataPtr); - } + ImageFrame imgframe = new ImageFrame(ImageFormat.Srgba, + cFrame.Width, cFrame.Height, cFrame.WidthStep, cFrame.RawData); using ImageFrame img = calculator.Send(imgframe); imgframe.Dispose(); diff --git a/Mediapipe.Net.Examples.FaceMeshGpu/Program.cs b/Mediapipe.Net.Examples.FaceMeshGpu/Program.cs index 6d9786fe..ab11a69f 100644 --- a/Mediapipe.Net.Examples.FaceMeshGpu/Program.cs +++ b/Mediapipe.Net.Examples.FaceMeshGpu/Program.cs @@ -73,12 +73,8 @@ private static unsafe void onFrame(object? sender, FrameEventArgs e) Frame cFrame = converter.Convert(frame); - ImageFrame imgframe; - fixed (byte* rawDataPtr = cFrame.RawData) - { - imgframe = new ImageFrame(ImageFormat.Srgba, - cFrame.Width, cFrame.Height, cFrame.WidthStep, rawDataPtr); - } + ImageFrame imgframe = new ImageFrame(ImageFormat.Srgba, + cFrame.Width, cFrame.Height, cFrame.WidthStep, cFrame.RawData); using ImageFrame img = calculator.Send(imgframe); imgframe.Dispose();