Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$ git ls-files -z | xargs -0 sed -i 's/Size.Zero/default/' #78

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/test.linq
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion docs/ocr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Sdcb.PaddleDetection/Preprocessers/ResizeOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sdcb.PaddleOCR/PaddleOcrDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down