From 338adac7f7b1244b34ef8eb2509e89dd4f0e99c7 Mon Sep 17 00:00:00 2001 From: n0099 Date: Thu, 4 Jan 2024 04:07:03 +0800 Subject: [PATCH] $ git ls-files -z | xargs -0 sed -i 's/Size.Zero/default/' --- build/test.linq | 2 +- docs/ocr.md | 2 +- src/Sdcb.PaddleDetection/Preprocessers/ResizeOperation.cs | 2 +- src/Sdcb.PaddleOCR/PaddleOcrDetector.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/test.linq b/build/test.linq index 54b75de..e424df2 100644 --- a/build/test.linq +++ b/build/test.linq @@ -29,7 +29,7 @@ using PaddleOcrAll all = new(model.DetectionDirectory, model.ClassifierDirectory //var predictor = PaddleConfig.FromModelDir(model.DetectionDirectory); //predictor.Dump(); -using Mat scaled = src.Resize(Size.Zero, 1, 1); +using Mat scaled = src.Resize(default, 1, 1); var sw = Stopwatch.StartNew(); PaddleOcrResult result = all.Run(scaled); sw.ElapsedMilliseconds.Dump("elapsed"); diff --git a/docs/ocr.md b/docs/ocr.md index f58e855..36efcae 100644 --- a/docs/ocr.md +++ b/docs/ocr.md @@ -259,7 +259,7 @@ public class OcrController : Controller stream.CopyTo(ms); using Mat src = Cv2.ImDecode(ms.ToArray(), ImreadModes.Color); double scale = 1; - using Mat scaled = src.Resize(Size.Zero, scale, scale); + using Mat scaled = src.Resize(default, scale, scale); Stopwatch sw = Stopwatch.StartNew(); string textResult = (await _ocr.Run(scaled)).Text; diff --git a/src/Sdcb.PaddleDetection/Preprocessers/ResizeOperation.cs b/src/Sdcb.PaddleDetection/Preprocessers/ResizeOperation.cs index e8bf8a2..6346f56 100644 --- a/src/Sdcb.PaddleDetection/Preprocessers/ResizeOperation.cs +++ b/src/Sdcb.PaddleDetection/Preprocessers/ResizeOperation.cs @@ -43,7 +43,7 @@ public override void Run(Mat src, ImageProcessContext data) Size size = src.Size(); data.NetShape = new Size2f(size.Width * scale.X, size.Height * scale.Y); - Cv2.Resize(src, src, Size.Zero, scale.X, scale.Y, Interpolation); + Cv2.Resize(src, src, default, scale.X, scale.Y, Interpolation); data.Shape = src.Size(); data.ScaleFactor = scale; } diff --git a/src/Sdcb.PaddleOCR/PaddleOcrDetector.cs b/src/Sdcb.PaddleOCR/PaddleOcrDetector.cs index ea03639..bb2d991 100644 --- a/src/Sdcb.PaddleOCR/PaddleOcrDetector.cs +++ b/src/Sdcb.PaddleOCR/PaddleOcrDetector.cs @@ -257,7 +257,7 @@ private static Mat MatResize(Mat src, int? maxSize) double scaleRate = 1.0 * maxSize.Value / longEdge; return scaleRate < 1.0 ? - src.Resize(Size.Zero, scaleRate, scaleRate) : + src.Resize(default, scaleRate, scaleRate) : src.Clone(); }