From 5fef3d22246657e5d09ad2a8b1cefcf06fe40a75 Mon Sep 17 00:00:00 2001 From: yi_Xu Date: Sun, 23 Nov 2025 10:10:48 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E8=A1=A5=E5=85=85=20barcode=20?= =?UTF-8?q?=E7=B1=BB=E5=AE=8C=E5=96=84=E4=B8=80=E7=BB=B4=E7=A0=81=E8=AF=86?= =?UTF-8?q?=E5=88=AB=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NativeMethods/NativeMethods_barcode.cs | 25 +++++ .../Modules/barcode/BarcodeDetector.cs | 101 ++++++++++++++++++ .../OpenCvSharpExtern.vcxproj | 2 + .../OpenCvSharpExtern.vcxproj.filters | 6 ++ src/OpenCvSharpExtern/barcode.cpp | 1 + src/OpenCvSharpExtern/barcode.h | 31 ++++++ .../OpenCvSharp.Tests.Windows.csproj | 24 +++-- 7 files changed, 180 insertions(+), 10 deletions(-) create mode 100644 src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs create mode 100644 src/OpenCvSharp/Modules/barcode/BarcodeDetector.cs create mode 100644 src/OpenCvSharpExtern/barcode.cpp create mode 100644 src/OpenCvSharpExtern/barcode.h diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs new file mode 100644 index 000000000..2f5212a5b --- /dev/null +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs @@ -0,0 +1,25 @@ +using System.Diagnostics.Contracts; +using System.Runtime.InteropServices; +#pragma warning disable 1591 +#pragma warning disable CA1401 // P/Invokes should not be visible +#pragma warning disable CA1707 // Underscore +#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments +#pragma warning disable IDE1006 // Naming style + + +namespace OpenCvSharp.Internal; + +static partial class NativeMethods +{ + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus barcode_detector_create([MarshalAs(UnmanagedType.LPStr)] string super_resolution_prototxt_path, + [MarshalAs(UnmanagedType.LPStr)] string super_resolution_caffe_model_path, out IntPtr ptr); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus barcode_detector_BarcodeDetector_detectAndDecodeWithType(IntPtr obj, IntPtr inputImage, IntPtr points, IntPtr infos, IntPtr types); + + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus barcode_detector_Ptr_BarcodeDetector_get(IntPtr ptr, out IntPtr ret); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus barcode_detector_Ptr_delete(IntPtr ptr); +} diff --git a/src/OpenCvSharp/Modules/barcode/BarcodeDetector.cs b/src/OpenCvSharp/Modules/barcode/BarcodeDetector.cs new file mode 100644 index 000000000..bc5d1262a --- /dev/null +++ b/src/OpenCvSharp/Modules/barcode/BarcodeDetector.cs @@ -0,0 +1,101 @@ +using OpenCvSharp.Internal; +using OpenCvSharp.Internal.Vectors; + +namespace OpenCvSharp; + +/// +/// WeChat QRCode includes two CNN-based models: +/// A object detection model and a super resolution model. +/// Object detection model is applied to detect QRCode with the bounding box. +/// super resolution model is applied to zoom in QRCode when it is small. +/// +public class BarcodeDetector : DisposableCvObject +{ + private Ptr? objectPtr; + + internal BarcodeDetector(IntPtr ptr) + { + objectPtr = new Ptr(ptr); + this.ptr = objectPtr.Get(); + } + + /// + /// Initialize the BarcodeDetector. + /// It includes two models, which are packaged with caffe format. + /// Therefore, there are prototxt and caffe models (In total, four paramenters). + /// + /// prototxt file path for the super resolution model + /// caffe file path for the super resolution model + /// + /// + public static BarcodeDetector Create( + string superResolutionPrototxtPath, + string superResolutionCaffeModelPath) + { + if (string.IsNullOrWhiteSpace(superResolutionPrototxtPath)) + throw new ArgumentException("empty string", nameof(superResolutionPrototxtPath)); + if (string.IsNullOrWhiteSpace(superResolutionCaffeModelPath)) + throw new ArgumentException("empty string", nameof(superResolutionCaffeModelPath)); + + NativeMethods.HandleException( + NativeMethods.barcode_detector_create( + superResolutionPrototxtPath, superResolutionCaffeModelPath, + out var ptr)); + + return new BarcodeDetector(ptr); + } + + /// + /// Both detects and decodes QR code. + /// To simplify the usage, there is a only API: detectAndDecode + /// + /// supports grayscale or color(BGR) image. + /// optional output array of vertices of the found QR code quadrangle.Will be empty if not found. + /// list of decoded string. + /// list of decoded types. + public void DetectAndDecode(InputArray inputImage, out Point2f[] points, out string[] results, out string[] types) + { + if (inputImage is null) + throw new ArgumentNullException(nameof(inputImage)); + inputImage.ThrowIfDisposed(); + + using var pointsVec = new VectorOfPoint2f(); + using var infos = new VectorOfString(); + using var resultTypes = new VectorOfString(); + NativeMethods.HandleException( + NativeMethods.barcode_detector_BarcodeDetector_detectAndDecodeWithType( + ptr, inputImage.CvPtr, pointsVec.CvPtr, infos.CvPtr, resultTypes.CvPtr)); + + points = pointsVec.ToArray(); + results = infos.ToArray(); + types = resultTypes.ToArray(); + GC.KeepAlive(this); + GC.KeepAlive(inputImage); + } + + /// + protected override void DisposeManaged() + { + objectPtr?.Dispose(); + objectPtr = null; + base.DisposeManaged(); + } + + internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) + { + public override IntPtr Get() + { + NativeMethods.HandleException( + NativeMethods.barcode_detector_Ptr_BarcodeDetector_get(ptr, out var ret)); + GC.KeepAlive(this); + return ret; + } + + protected override void DisposeUnmanaged() + { + NativeMethods.HandleException( + NativeMethods.barcode_detector_Ptr_delete(ptr)); + base.DisposeUnmanaged(); + } + } +} diff --git a/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj b/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj index 9644d3992..d0f1e82b1 100644 --- a/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj +++ b/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj @@ -228,6 +228,7 @@ copy "$(SolutionDir)opencv_files\opencv_win_x64\x64\vc17\bin\opencv_videoio_ffmp + @@ -263,6 +264,7 @@ copy "$(SolutionDir)opencv_files\opencv_win_x64\x64\vc17\bin\opencv_videoio_ffmp + diff --git a/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters b/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters index b9c96c843..61f530d2b 100644 --- a/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters +++ b/src/OpenCvSharpExtern/OpenCvSharpExtern.vcxproj.filters @@ -100,6 +100,9 @@ Source Files + + Source Files + @@ -378,6 +381,9 @@ Header Files\imgproc + + Header Files + diff --git a/src/OpenCvSharpExtern/barcode.cpp b/src/OpenCvSharpExtern/barcode.cpp new file mode 100644 index 000000000..38e1e4cfe --- /dev/null +++ b/src/OpenCvSharpExtern/barcode.cpp @@ -0,0 +1 @@ +#include "barcode.h" diff --git a/src/OpenCvSharpExtern/barcode.h b/src/OpenCvSharpExtern/barcode.h new file mode 100644 index 000000000..65ef110b5 --- /dev/null +++ b/src/OpenCvSharpExtern/barcode.h @@ -0,0 +1,31 @@ +#pragma once +#include "include_opencv.h" +CVAPI(ExceptionStatus) barcode_detector_create(const char *super_resolution_prototxt_path, + const char *super_resolution_caffe_model_path, cv::Ptr **returnValue) +{ + BEGIN_WRAP + cv::Ptr detector; + detector = cv::makePtr(super_resolution_prototxt_path, super_resolution_caffe_model_path); + *returnValue = clone(detector); + END_WRAP +} +CVAPI(ExceptionStatus) barcode_detector_Ptr_delete(cv::Ptr* obj) +{ + BEGIN_WRAP + delete obj; + END_WRAP +} + +CVAPI(ExceptionStatus) barcode_detector_Ptr_BarcodeDetector_get(cv::Ptr* obj, cv::barcode::BarcodeDetector **returnValue) +{ + BEGIN_WRAP + * returnValue = obj->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) barcode_detector_BarcodeDetector_detectAndDecodeWithType(cv::barcode::BarcodeDetector* obj, cv::_InputArray* inputImage, std::vector* points, std::vector* detectorInfos, std::vector* detectorTypes) +{ + BEGIN_WRAP + obj->detectAndDecodeWithType(*inputImage, *detectorInfos, *detectorTypes, *points); + END_WRAP +} diff --git a/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj b/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj index d5f0cf966..45ee8eb66 100644 --- a/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj +++ b/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj @@ -20,16 +20,20 @@ - - - - - - - - - - + + + + + + + + + + + + + + From 390fe62aaae0cfc4e74ce0d5f5816589ae2bcc10 Mon Sep 17 00:00:00 2001 From: yi_Xu Date: Sun, 23 Nov 2025 15:23:17 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E9=87=8D=E6=9E=84=20barcodeDetecto?= =?UTF-8?q?r=20=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NativeMethods/NativeMethods_barcode.cs | 55 +++++++++++++-- .../Modules/barcode/BarcodeDetector.cs | 68 ++++++++++++++++--- src/OpenCvSharpExtern/barcode.h | 54 +++++++++++++-- 3 files changed, 155 insertions(+), 22 deletions(-) diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs index 2f5212a5b..4b12d3c4e 100644 --- a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs @@ -12,14 +12,57 @@ namespace OpenCvSharp.Internal; static partial class NativeMethods { [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ExceptionStatus barcode_detector_create([MarshalAs(UnmanagedType.LPStr)] string super_resolution_prototxt_path, - [MarshalAs(UnmanagedType.LPStr)] string super_resolution_caffe_model_path, out IntPtr ptr); + public static extern ExceptionStatus barcode_BarcodeDetector_create(out IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus barcode_BarcodeDetector_create( + [MarshalAs(UnmanagedType.LPStr)] string super_resolution_prototxt_path, + [MarshalAs(UnmanagedType.LPStr)] string super_resolution_caffe_model_path, + out IntPtr ptr + ); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus barcode_BarcodeDetector_setDownsamplingThreshold( + IntPtr obj, + double thresh + ); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus barcode_BarcodeDetector_setDetectorScales( + IntPtr obj, + IntPtr sizes + ); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus barcode_BarcodeDetector_setGradientThreshold( + IntPtr obj, + double thresh + ); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ExceptionStatus barcode_detector_BarcodeDetector_detectAndDecodeWithType(IntPtr obj, IntPtr inputImage, IntPtr points, IntPtr infos, IntPtr types); - + public static extern ExceptionStatus barcode_Ptr_BarcodeDetector_get( + IntPtr ptr, + out IntPtr ret + ); [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ExceptionStatus barcode_detector_Ptr_BarcodeDetector_get(IntPtr ptr, out IntPtr ret); + public static extern ExceptionStatus barcode_Ptr_BarcodeDetector_delete(IntPtr ptr); + + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern ExceptionStatus barcode_BarcodeDetector_decodeWithType( + IntPtr obj, + IntPtr inputImage, + IntPtr points, + IntPtr infos, + IntPtr types + ); + [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ExceptionStatus barcode_detector_Ptr_delete(IntPtr ptr); + public static extern ExceptionStatus barcode_BarcodeDetector_detectAndDecodeWithType( + IntPtr obj, + IntPtr inputImage, + IntPtr points, + IntPtr infos, + IntPtr types + ); } diff --git a/src/OpenCvSharp/Modules/barcode/BarcodeDetector.cs b/src/OpenCvSharp/Modules/barcode/BarcodeDetector.cs index bc5d1262a..8e9141e7a 100644 --- a/src/OpenCvSharp/Modules/barcode/BarcodeDetector.cs +++ b/src/OpenCvSharp/Modules/barcode/BarcodeDetector.cs @@ -4,10 +4,8 @@ namespace OpenCvSharp; /// -/// WeChat QRCode includes two CNN-based models: -/// A object detection model and a super resolution model. -/// Object detection model is applied to detect QRCode with the bounding box. -/// super resolution model is applied to zoom in QRCode when it is small. +/// BarcodeDetector use a super resolution model. +/// super resolution model is applied to zoom in Barcode when it is small. /// public class BarcodeDetector : DisposableCvObject { @@ -21,7 +19,7 @@ internal BarcodeDetector(IntPtr ptr) /// /// Initialize the BarcodeDetector. - /// It includes two models, which are packaged with caffe format. + /// It includes one models, which are packaged with caffe format. /// Therefore, there are prototxt and caffe models (In total, four paramenters). /// /// prototxt file path for the super resolution model @@ -38,7 +36,7 @@ public static BarcodeDetector Create( throw new ArgumentException("empty string", nameof(superResolutionCaffeModelPath)); NativeMethods.HandleException( - NativeMethods.barcode_detector_create( + NativeMethods.barcode_BarcodeDetector_create( superResolutionPrototxtPath, superResolutionCaffeModelPath, out var ptr)); @@ -46,11 +44,59 @@ public static BarcodeDetector Create( } /// - /// Both detects and decodes QR code. + /// Set detector downsampling threshold. + /// + /// By default, the detect method resizes the input image to this limit if the smallest image size is is greater than the threshold. + /// Increasing this value can improve detection accuracy and the number of results at the expense of performance. + /// Correlates with detector scales.Setting this to a large value will disable downsampling. + /// + /// downsampling limit to apply (default 512). + public void SetDownsamplingThreshold(double thresh) + { + NativeMethods.HandleException( + NativeMethods.barcode_BarcodeDetector_setDownsamplingThreshold(ptr, thresh)); + GC.KeepAlive(this); + } + + /// + /// Set detector gradient magnitude threshold. + /// + /// Sets the coherence threshold for detected bounding boxes. + /// Increasing this value will generate a closer fitted bounding box width and can reduce false-positives. + /// Values between 16 and 1024 generally work, while too high of a value will remove valid detections. + /// + /// gradient magnitude threshold (default 64). + public void SetGradientThreshold(double thresh) + { + NativeMethods.HandleException( + NativeMethods.barcode_BarcodeDetector_setGradientThreshold(ptr, thresh)); + GC.KeepAlive(this); + } + + /// + /// Set detector box filter sizes. + /// + /// Adjusts the value and the number of box filters used in the detect step. + /// The filter sizes directly correlate with the expected line widths for a barcode.Corresponds to expected barcode distance. + /// If the downsampling limit is increased, filter sizes need to be adjusted in an inversely proportional way. + /// + /// box filter sizes, relative to minimum dimension of the image (default [0.01, 0.03, 0.06, 0.08]). + public void SetDetectorScales(IEnumerable sizes) + { + if (sizes is null) + throw new ArgumentNullException(nameof(sizes)); + using var sizesVec = new VectorOfFloat(sizes); + NativeMethods.HandleException( + NativeMethods.barcode_BarcodeDetector_setDetectorScales(ptr, sizesVec.CvPtr)); + GC.KeepAlive(this); + } + + /// + /// Both detects and decodes barcode. /// To simplify the usage, there is a only API: detectAndDecode /// /// supports grayscale or color(BGR) image. - /// optional output array of vertices of the found QR code quadrangle.Will be empty if not found. + /// optional output vector of vertices of the found barcode rectangle. Will be empty if not found. /// list of decoded string. /// list of decoded types. public void DetectAndDecode(InputArray inputImage, out Point2f[] points, out string[] results, out string[] types) @@ -63,7 +109,7 @@ public void DetectAndDecode(InputArray inputImage, out Point2f[] points, out str using var infos = new VectorOfString(); using var resultTypes = new VectorOfString(); NativeMethods.HandleException( - NativeMethods.barcode_detector_BarcodeDetector_detectAndDecodeWithType( + NativeMethods.barcode_BarcodeDetector_detectAndDecodeWithType( ptr, inputImage.CvPtr, pointsVec.CvPtr, infos.CvPtr, resultTypes.CvPtr)); points = pointsVec.ToArray(); @@ -86,7 +132,7 @@ internal class Ptr(IntPtr ptr) : OpenCvSharp.Ptr(ptr) public override IntPtr Get() { NativeMethods.HandleException( - NativeMethods.barcode_detector_Ptr_BarcodeDetector_get(ptr, out var ret)); + NativeMethods.barcode_Ptr_BarcodeDetector_get(ptr, out var ret)); GC.KeepAlive(this); return ret; } @@ -94,7 +140,7 @@ public override IntPtr Get() protected override void DisposeUnmanaged() { NativeMethods.HandleException( - NativeMethods.barcode_detector_Ptr_delete(ptr)); + NativeMethods.barcode_Ptr_BarcodeDetector_delete(ptr)); base.DisposeUnmanaged(); } } diff --git a/src/OpenCvSharpExtern/barcode.h b/src/OpenCvSharpExtern/barcode.h index 65ef110b5..4102fa3f3 100644 --- a/src/OpenCvSharpExtern/barcode.h +++ b/src/OpenCvSharpExtern/barcode.h @@ -1,6 +1,18 @@ #pragma once + #include "include_opencv.h" -CVAPI(ExceptionStatus) barcode_detector_create(const char *super_resolution_prototxt_path, + + +CVAPI(ExceptionStatus) barcode_BarcodeDetector_create(cv::Ptr **returnValue) +{ + BEGIN_WRAP + cv::Ptr detector; + detector = cv::makePtr(); + *returnValue = clone(detector); + END_WRAP +} + +CVAPI(ExceptionStatus) barcode_BarcodeDetector_create(const char *super_resolution_prototxt_path, const char *super_resolution_caffe_model_path, cv::Ptr **returnValue) { BEGIN_WRAP @@ -9,21 +21,53 @@ CVAPI(ExceptionStatus) barcode_detector_create(const char *super_resolution_prot *returnValue = clone(detector); END_WRAP } -CVAPI(ExceptionStatus) barcode_detector_Ptr_delete(cv::Ptr* obj) + +CVAPI(ExceptionStatus) barcode_BarcodeDetector_setDownsamplingThreshold(cv::barcode::BarcodeDetector *obj, double thresh) +{ + BEGIN_WRAP + obj->setDownsamplingThreshold(thresh); + END_WRAP +} + +CVAPI(ExceptionStatus) barcode_BarcodeDetector_setDetectorScales(cv::barcode::BarcodeDetector *obj, std::vector *sizes) +{ + BEGIN_WRAP + obj->setDetectorScales(*sizes); + END_WRAP +} + +CVAPI(ExceptionStatus) barcode_BarcodeDetector_setGradientThreshold(cv::barcode::BarcodeDetector *obj, double thresh) +{ + BEGIN_WRAP + obj->setGradientThreshold(thresh); + END_WRAP +} + + +CVAPI(ExceptionStatus) barcode_Ptr_BarcodeDetector_delete(cv::Ptr *obj) { BEGIN_WRAP delete obj; END_WRAP } -CVAPI(ExceptionStatus) barcode_detector_Ptr_BarcodeDetector_get(cv::Ptr* obj, cv::barcode::BarcodeDetector **returnValue) +CVAPI(ExceptionStatus) barcode_Ptr_BarcodeDetector_get(cv::Ptr *obj, cv::barcode::BarcodeDetector **returnValue) +{ + BEGIN_WRAP + *returnValue = obj->get(); + END_WRAP +} + +CVAPI(ExceptionStatus) barcode_BarcodeDetector_decodeWithType(cv::barcode::BarcodeDetector *obj, cv::_InputArray *inputImage, + std::vector *points, std::vector *detectorInfos, std::vector *detectorTypes) { BEGIN_WRAP - * returnValue = obj->get(); + obj->decodeWithType(*inputImage, *points, *detectorInfos, *detectorTypes); END_WRAP } -CVAPI(ExceptionStatus) barcode_detector_BarcodeDetector_detectAndDecodeWithType(cv::barcode::BarcodeDetector* obj, cv::_InputArray* inputImage, std::vector* points, std::vector* detectorInfos, std::vector* detectorTypes) +CVAPI(ExceptionStatus) barcode_BarcodeDetector_detectAndDecodeWithType(cv::barcode::BarcodeDetector *obj, cv::_InputArray *inputImage, + std::vector *points, std::vector *detectorInfos, std::vector *detectorTypes) { BEGIN_WRAP obj->detectAndDecodeWithType(*inputImage, *detectorInfos, *detectorTypes, *points); From b386e1868c8e2e93ac9a165b926e248638f73586 Mon Sep 17 00:00:00 2001 From: yi_Xu Date: Sun, 23 Nov 2025 15:51:17 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E9=87=8D=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PInvoke/NativeMethods/NativeMethods_barcode.cs | 2 -- src/OpenCvSharpExtern/barcode.h | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs index 4b12d3c4e..8d15e9d6d 100644 --- a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods_barcode.cs @@ -11,8 +11,6 @@ namespace OpenCvSharp.Internal; static partial class NativeMethods { - [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern ExceptionStatus barcode_BarcodeDetector_create(out IntPtr ptr); [Pure, DllImport(DllExtern, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern ExceptionStatus barcode_BarcodeDetector_create( diff --git a/src/OpenCvSharpExtern/barcode.h b/src/OpenCvSharpExtern/barcode.h index 4102fa3f3..430ad2369 100644 --- a/src/OpenCvSharpExtern/barcode.h +++ b/src/OpenCvSharpExtern/barcode.h @@ -2,16 +2,6 @@ #include "include_opencv.h" - -CVAPI(ExceptionStatus) barcode_BarcodeDetector_create(cv::Ptr **returnValue) -{ - BEGIN_WRAP - cv::Ptr detector; - detector = cv::makePtr(); - *returnValue = clone(detector); - END_WRAP -} - CVAPI(ExceptionStatus) barcode_BarcodeDetector_create(const char *super_resolution_prototxt_path, const char *super_resolution_caffe_model_path, cv::Ptr **returnValue) { From 8ac0a7e11ca096d1073cf7c2fcf4f14bea3243ed Mon Sep 17 00:00:00 2001 From: yi_Xu Date: Sun, 23 Nov 2025 15:56:45 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj b/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj index 45ee8eb66..12a44c7d9 100644 --- a/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj +++ b/test/OpenCvSharp.Tests.Windows/OpenCvSharp.Tests.Windows.csproj @@ -32,7 +32,7 @@ - +