Skip to content

Commit

Permalink
Let examples use the new safe constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Speykious committed Feb 2, 2022
1 parent ce85bd5 commit d0bbbe4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions Mediapipe.Net.Examples.FaceMesh/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 2 additions & 6 deletions Mediapipe.Net.Examples.FaceMeshGpu/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d0bbbe4

Please sign in to comment.