bitmapSource.PixelWidth www.laipuhuo.com * bitmapSource

69 阅读1分钟

private async void RecognizeButton_OnClick(object sender, RoutedEventArgs e) { var width = (int) InkCanvas.ActualWidth; var height = (int) InkCanvas.ActualHeight; var bitmapSource = new RenderTargetBitmap(width, height, 96, 96, PixelFormats.Pbgra32);

bitmapSource.Render(InkCanvas); var length = bitmapSource.PixelWidth * bitmapSource.PixelHeight * bitmapSource.Format.BitsPerPixel / 8; var byteArray = new byte[length]; var stride = bitmapSource.PixelWidth * bitmapSource.Format.BitsPerPixel / 8;

bitmapSource.CopyPixels(byteArray, stride, 0); IBuffer buffer = byteArray.AsBuffer(); var softwareBitmap = SoftwareBitmap.CreateCopyFromBuffer(buffer, BitmapPixelFormat.Bgra8, bitmapSource.PixelWidth, bitmapSource.PixelHeight); VideoFrame inputImage =

VideoFrame.CreateWithSoftwareBitmap(softwareBitmap); var imageFeatureValue = ImageFeatureValue.CreateFromVideoFrame(inputImage); LearningModelBinding.Bind("Input3", imageFeatureValue); var result = await LearningModel

Session.EvaluateAsync(LearningModelBinding, "0"); var resultOutput = result.Outputs["Plus214_Output_0"] as www.laipuhuo.com TensorFloat; var vectorView = resultOutput?.GetAsVectorView(); if (vectorView != null) { var maxValue = 0f; var maxIndex = -1; // 10 个数字,每个数字 for (var number = 0; number < vectorView.Count; number++)

git init
git remote add origin https://gitee.com/lindexi/lindexi_gd.git
git pull origin 29df54af3d2471c002303eb412372b844b0708bc

以上使用的是 gitee 的源,如果 gitee 不能访问,请替换为 github 的源。请在命令行继续输入以下代码

git remote remove origin www.laipuhuo.com
git remote add origin https://github.com/lindexi/lindexi_gd.git
git pull origin 29df54af3d2471c002303eb412372b844b0708bc