diff --git a/src/Sdcb.Paddle2Onnx/Sdcb.Paddle2Onnx.csproj b/src/Sdcb.Paddle2Onnx/Sdcb.Paddle2Onnx.csproj index 25803e7..e7b461c 100644 --- a/src/Sdcb.Paddle2Onnx/Sdcb.Paddle2Onnx.csproj +++ b/src/Sdcb.Paddle2Onnx/Sdcb.Paddle2Onnx.csproj @@ -32,7 +32,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Sdcb.PaddleDetection/Preprocessers/PermuteOperation.cs b/src/Sdcb.PaddleDetection/Preprocessers/PermuteOperation.cs index b6f6dba..196c8d1 100644 --- a/src/Sdcb.PaddleDetection/Preprocessers/PermuteOperation.cs +++ b/src/Sdcb.PaddleDetection/Preprocessers/PermuteOperation.cs @@ -20,10 +20,7 @@ public override void Run(Mat src, ImageProcessContext data) IntPtr resultPtr = resultHandle.AddrOfPinnedObject(); for (int i = 0; i < channels; ++i) { - using Mat cmat = new( - src.Height, src.Width, - MatType.CV_32FC1, - resultPtr + i * size.Width * size.Height * sizeof(float)); + using Mat cmat = Mat.FromPixelData(src.Height, src.Width, MatType.CV_32FC1, resultPtr + i * size.Width * size.Height * sizeof(float)); Cv2.ExtractChannel(src, cmat, i); } diff --git a/src/Sdcb.PaddleDetection/Sdcb.PaddleDetection.csproj b/src/Sdcb.PaddleDetection/Sdcb.PaddleDetection.csproj index 6382c1c..efe79ac 100644 --- a/src/Sdcb.PaddleDetection/Sdcb.PaddleDetection.csproj +++ b/src/Sdcb.PaddleDetection/Sdcb.PaddleDetection.csproj @@ -31,7 +31,7 @@ - + diff --git a/src/Sdcb.PaddleOCR/PaddleOcrDetector.cs b/src/Sdcb.PaddleOCR/PaddleOcrDetector.cs index f5d0c1e..c314d3b 100644 --- a/src/Sdcb.PaddleOCR/PaddleOcrDetector.cs +++ b/src/Sdcb.PaddleOCR/PaddleOcrDetector.cs @@ -214,7 +214,7 @@ public Mat RunRaw(Mat src, out Size resizedSize) float[] data = output.GetData(); int[] shape = output.Shape; - return new Mat(shape[2], shape[3], MatType.CV_32FC1, data); + return Mat.FromPixelData(shape[2], shape[3], MatType.CV_32FC1, data); } } @@ -274,7 +274,7 @@ internal static float[] ExtractMat(Mat src) IntPtr resultPtr = resultHandle.AddrOfPinnedObject(); for (int i = 0; i < src.Channels(); ++i) { - using Mat dest = new(rows, cols, MatType.CV_32FC1, resultPtr + i * rows * cols * sizeof(float)); + using Mat dest = Mat.FromPixelData(rows, cols, MatType.CV_32FC1, resultPtr + i * rows * cols * sizeof(float)); Cv2.ExtractChannel(src, dest, i); } } diff --git a/src/Sdcb.PaddleOCR/PaddleOcrRecognizer.cs b/src/Sdcb.PaddleOCR/PaddleOcrRecognizer.cs index de07f76..8d37b43 100644 --- a/src/Sdcb.PaddleOCR/PaddleOcrRecognizer.cs +++ b/src/Sdcb.PaddleOCR/PaddleOcrRecognizer.cs @@ -174,7 +174,7 @@ private PaddleOcrRecognizerResult[] RunMulti(Mat[] srcs) float score = 0; for (int n = 0; n < charCount; ++n) { - using Mat mat = new(1, labelCount, MatType.CV_32FC1, dataPtr + (n + i * charCount) * labelCount * sizeof(float)); + using Mat mat = Mat.FromPixelData(1, labelCount, MatType.CV_32FC1, dataPtr + (n + i * charCount) * labelCount * sizeof(float)); int[] maxIdx = new int[2]; mat.MinMaxIdx(out double _, out double maxVal, new int[0], maxIdx); @@ -253,7 +253,7 @@ private static float[] ExtractMat(Mat[] srcs, int channel, int height, int width } for (int c = 0; c < channel; ++c) { - using Mat dest = new(height, width, MatType.CV_32FC1, resultPtr + (c + i * channel) * height * width * sizeof(float)); + using Mat dest = Mat.FromPixelData(height, width, MatType.CV_32FC1, resultPtr + (c + i * channel) * height * width * sizeof(float)); Cv2.ExtractChannel(src, dest, c); } } diff --git a/src/Sdcb.PaddleOCR/PaddleOcrTableRecognizer.cs b/src/Sdcb.PaddleOCR/PaddleOcrTableRecognizer.cs index 6ecb9c6..799e5db 100644 --- a/src/Sdcb.PaddleOCR/PaddleOcrTableRecognizer.cs +++ b/src/Sdcb.PaddleOCR/PaddleOcrTableRecognizer.cs @@ -138,7 +138,7 @@ static float[] ExtractMat(Mat src) IntPtr resultPtr = resultHandle.AddrOfPinnedObject(); for (int i = 0; i < src.Channels(); ++i) { - using Mat dest = new(rows, cols, MatType.CV_32FC1, resultPtr + i * rows * cols * sizeof(float)); + using Mat dest = Mat.FromPixelData(rows, cols, MatType.CV_32FC1, resultPtr + i * rows * cols * sizeof(float)); Cv2.ExtractChannel(src, dest, i); } } diff --git a/src/Sdcb.PaddleOCR/Sdcb.PaddleOCR.csproj b/src/Sdcb.PaddleOCR/Sdcb.PaddleOCR.csproj index 85ff07b..8ab5141 100644 --- a/src/Sdcb.PaddleOCR/Sdcb.PaddleOCR.csproj +++ b/src/Sdcb.PaddleOCR/Sdcb.PaddleOCR.csproj @@ -30,7 +30,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Sdcb.RotationDetector/PaddleRotationDetector.cs b/src/Sdcb.RotationDetector/PaddleRotationDetector.cs index f0e2ac5..45c907d 100644 --- a/src/Sdcb.RotationDetector/PaddleRotationDetector.cs +++ b/src/Sdcb.RotationDetector/PaddleRotationDetector.cs @@ -103,7 +103,7 @@ internal static float[] ExtractMat(Mat src) IntPtr resultPtr = resultHandle.AddrOfPinnedObject(); for (int i = 0; i < src.Channels(); ++i) { - using Mat dest = new(rows, cols, MatType.CV_32FC1, resultPtr + i * rows * cols * sizeof(float)); + using Mat dest = Mat.FromPixelData(rows, cols, MatType.CV_32FC1, resultPtr + i * rows * cols * sizeof(float)); Cv2.ExtractChannel(src, dest, i); } } diff --git a/src/Sdcb.RotationDetector/Sdcb.RotationDetector.csproj b/src/Sdcb.RotationDetector/Sdcb.RotationDetector.csproj index 7aa0145..2dab8b3 100644 --- a/src/Sdcb.RotationDetector/Sdcb.RotationDetector.csproj +++ b/src/Sdcb.RotationDetector/Sdcb.RotationDetector.csproj @@ -35,7 +35,7 @@ - + diff --git a/tests/Sdcb.Paddle2Onnx.Tests/Sdcb.Paddle2Onnx.Tests.csproj b/tests/Sdcb.Paddle2Onnx.Tests/Sdcb.Paddle2Onnx.Tests.csproj index 3cf8371..b792e37 100644 --- a/tests/Sdcb.Paddle2Onnx.Tests/Sdcb.Paddle2Onnx.Tests.csproj +++ b/tests/Sdcb.Paddle2Onnx.Tests/Sdcb.Paddle2Onnx.Tests.csproj @@ -12,14 +12,14 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Sdcb.PaddleInference.Tests/Sdcb.PaddleInference.Tests.csproj b/tests/Sdcb.PaddleInference.Tests/Sdcb.PaddleInference.Tests.csproj index b6e25c1..10bb859 100644 --- a/tests/Sdcb.PaddleInference.Tests/Sdcb.PaddleInference.Tests.csproj +++ b/tests/Sdcb.PaddleInference.Tests/Sdcb.PaddleInference.Tests.csproj @@ -10,10 +10,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Sdcb.PaddleNLP.Lac.Tests/Sdcb.PaddleNLP.Lac.Tests.csproj b/tests/Sdcb.PaddleNLP.Lac.Tests/Sdcb.PaddleNLP.Lac.Tests.csproj index 81478ff..16dcde2 100644 --- a/tests/Sdcb.PaddleNLP.Lac.Tests/Sdcb.PaddleNLP.Lac.Tests.csproj +++ b/tests/Sdcb.PaddleNLP.Lac.Tests/Sdcb.PaddleNLP.Lac.Tests.csproj @@ -11,11 +11,17 @@ - - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/tests/Sdcb.PaddleOCR.Tests/Sdcb.PaddleOCR.Tests.csproj b/tests/Sdcb.PaddleOCR.Tests/Sdcb.PaddleOCR.Tests.csproj index 9c2dce8..688da49 100644 --- a/tests/Sdcb.PaddleOCR.Tests/Sdcb.PaddleOCR.Tests.csproj +++ b/tests/Sdcb.PaddleOCR.Tests/Sdcb.PaddleOCR.Tests.csproj @@ -26,8 +26,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/Sdcb.RotationDetector.Tests/Sdcb.RotationDetector.Tests.csproj b/tests/Sdcb.RotationDetector.Tests/Sdcb.RotationDetector.Tests.csproj index 95ea060..c852657 100644 --- a/tests/Sdcb.RotationDetector.Tests/Sdcb.RotationDetector.Tests.csproj +++ b/tests/Sdcb.RotationDetector.Tests/Sdcb.RotationDetector.Tests.csproj @@ -9,16 +9,16 @@ - - - - - - + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all