From 243f1c7649f9585b1dd027bcb43347ccc5b9e743 Mon Sep 17 00:00:00 2001 From: shimat Date: Sun, 7 Feb 2021 19:12:17 +0900 Subject: [PATCH 1/3] fix warnings --- OpenCvSharp.sln | 75 ------ src/OpenCvSharp/Cv2/Cv2_calib3d.cs | 16 +- src/OpenCvSharp/Cv2/Cv2_core.cs | 92 +------ src/OpenCvSharp/Cv2/Cv2_cuda.cs | 27 -- src/OpenCvSharp/Cv2/Cv2_highgui.cs | 11 +- src/OpenCvSharp/Cv2/Cv2_imgproc.cs | 96 +------ src/OpenCvSharp/Cv2/Cv2_photo.cs | 16 +- src/OpenCvSharp/Fundamentals/Ptr.cs | 4 +- .../Fundamentals/ResourcesTracker.cs | 7 +- .../Internal/PInvoke/WindowsLibraryLoader.cs | 21 +- src/OpenCvSharp/Internal/Util/ArrayAddress.cs | 30 +-- .../Internal/Util/PInvokeHelper.cs | 3 + .../Internal/Util/ScopedGCHandle.cs | 234 +---------------- src/OpenCvSharp/Modules/aruco/CvAruco.cs | 2 + .../Modules/aruco/DetectorParameters.cs | 2 + .../Modules/core/FileNodeIterator.cs | 28 +- src/OpenCvSharp/Modules/core/InputArray.cs | 71 ++---- .../Modules/core/InputOutputArray.cs | 27 +- .../Modules/core/Mat/MatIndexer.cs | 2 + src/OpenCvSharp/Modules/core/Mat/MatOfT.cs | 2 + src/OpenCvSharp/Modules/core/MatExpr.cs | 31 ++- .../Modules/core/MatExprRowColIndexer.cs | 5 +- src/OpenCvSharp/Modules/core/OutputArray.cs | 19 +- src/OpenCvSharp/Modules/core/RNG_MT19937.cs | 5 +- src/OpenCvSharp/Modules/core/SparseMat.cs | 10 + src/OpenCvSharp/Modules/core/Struct/DMatch.cs | 71 ++---- src/OpenCvSharp/Modules/core/Struct/Point.cs | 133 ++++------ .../Modules/core/Struct/Point2d.cs | 156 +++++------- .../Modules/core/Struct/Point2f.cs | 151 ++++------- .../Modules/core/Struct/Point3d.cs | 116 ++++----- .../Modules/core/Struct/Point3f.cs | 166 +++++------- src/OpenCvSharp/Modules/core/Struct/Rangef.cs | 55 +++- src/OpenCvSharp/Modules/core/Struct/Rect.cs | 40 ++- src/OpenCvSharp/Modules/core/Struct/Rect2d.cs | 21 +- src/OpenCvSharp/Modules/core/Struct/Rect2f.cs | 40 +-- .../Modules/core/Struct/RotatedRect.cs | 41 ++- src/OpenCvSharp/Modules/core/Struct/Scalar.cs | 240 ++++-------------- .../Modules/core/Struct/TermCriteria.cs | 47 +++- .../Modules/core/Struct/Vec/Vec2b.cs | 1 - .../Modules/core/Struct/Vec/Vec2d.cs | 2 - .../Modules/core/Struct/Vec/Vec2f.cs | 2 - .../Modules/core/Struct/Vec/Vec2i.cs | 2 - .../Modules/core/Struct/Vec/Vec2s.cs | 2 - .../Modules/core/Struct/Vec/Vec2w.cs | 1 - .../Modules/core/Struct/Vec/Vec3b.cs | 1 - .../Modules/core/Struct/Vec/Vec3d.cs | 2 - .../Modules/core/Struct/Vec/Vec3f.cs | 2 - .../Modules/core/Struct/Vec/Vec3i.cs | 2 - .../Modules/core/Struct/Vec/Vec3s.cs | 2 - .../Modules/core/Struct/Vec/Vec3w.cs | 1 - .../Modules/core/Struct/Vec/Vec4b.cs | 1 - .../Modules/core/Struct/Vec/Vec4d.cs | 5 +- .../Modules/core/Struct/Vec/Vec4f.cs | 2 - .../Modules/core/Struct/Vec/Vec4i.cs | 2 - .../Modules/core/Struct/Vec/Vec4s.cs | 4 +- .../Modules/core/Struct/Vec/Vec4w.cs | 1 - .../Modules/core/Struct/Vec/Vec6b.cs | 1 - .../Modules/core/Struct/Vec/Vec6d.cs | 2 - .../Modules/core/Struct/Vec/Vec6f.cs | 2 - .../Modules/core/Struct/Vec/Vec6i.cs | 2 - .../Modules/core/Struct/Vec/Vec6s.cs | 2 - .../Modules/core/Struct/Vec/Vec6w.cs | 1 - .../Modules/features2d/BOWKMeansTrainer.cs | 3 + .../Modules/features2d/Feature2D.cs | 2 + .../Modules/features2d/SimpleBlobDetector.cs | 2 + .../Modules/flann/FlannDistance.cs | 11 +- src/OpenCvSharp/Modules/flann/Index.cs | 2 +- .../Modules/imgproc/ConnectedComponent.cs | 2 + .../Modules/imgproc/Model/Line3D.cs | 145 ++--------- src/OpenCvSharp/Modules/imgproc/Moments.cs | 4 +- .../Modules/line_descriptors/KeyLine.cs | 9 +- src/OpenCvSharp/Modules/ml/DTrees.cs | 6 + src/OpenCvSharp/Modules/ml/ParamGrid.cs | 5 +- src/OpenCvSharp/Modules/ml/SVM.cs | 3 + .../Modules/objdetect/HOGDescriptor.cs | 5 +- .../Modules/stitching/ImageFeatures.cs | 2 + src/OpenCvSharp/Modules/stitching/Stitcher.cs | 3 +- .../Modules/tracking/TrackerCSRT.cs | 2 + src/OpenCvSharp/Modules/video/Tracker.cs | 2 +- src/OpenCvSharp/Modules/video/TrackerMIL.cs | 2 + .../Modules/videoio/Enum/VideoCaptureAPIs.cs | 24 +- .../SelectiveSearchSegmentationStrategy.cs | 2 + ...ctiveSearchSegmentationStrategyMultiple.cs | 2 + 83 files changed, 813 insertions(+), 1583 deletions(-) diff --git a/OpenCvSharp.sln b/OpenCvSharp.sln index 8d78b6808..a181ad37a 100644 --- a/OpenCvSharp.sln +++ b/OpenCvSharp.sln @@ -40,10 +40,6 @@ Global Release|ARM = Release|ARM Release|x64 = Release|x64 Release|x86 = Release|x86 - Release-JP|Any CPU = Release-JP|Any CPU - Release-JP|ARM = Release-JP|ARM - Release-JP|x64 = Release-JP|x64 - Release-JP|x86 = Release-JP|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {EB310923-197F-4E20-B123-3A3E7F1D5069}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -62,14 +58,6 @@ Global {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|x64.Build.0 = Release|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|x86.ActiveCfg = Release|Any CPU {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release|x86.Build.0 = Release|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|ARM.ActiveCfg = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|ARM.Build.0 = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|x64.ActiveCfg = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|x64.Build.0 = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|x86.ActiveCfg = Release-JP|Any CPU - {EB310923-197F-4E20-B123-3A3E7F1D5069}.Release-JP|x86.Build.0 = Release-JP|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|Any CPU.Build.0 = Debug|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -86,14 +74,6 @@ Global {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|x64.Build.0 = Release|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|x86.ActiveCfg = Release|Any CPU {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release|x86.Build.0 = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|ARM.ActiveCfg = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|ARM.Build.0 = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|x64.ActiveCfg = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|x64.Build.0 = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|x86.ActiveCfg = Release|Any CPU - {FFBBCF99-97F0-4F81-AAF6-8D851A8E1D2E}.Release-JP|x86.Build.0 = Release|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|Any CPU.Build.0 = Debug|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -110,14 +90,6 @@ Global {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|x64.Build.0 = Release|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|x86.ActiveCfg = Release|Any CPU {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release|x86.Build.0 = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|ARM.ActiveCfg = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|ARM.Build.0 = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|x64.ActiveCfg = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|x64.Build.0 = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|x86.ActiveCfg = Release|Any CPU - {B4B78BB2-1B7C-4CF2-BC72-43789EEDCE00}.Release-JP|x86.Build.0 = Release|Any CPU {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|Any CPU.ActiveCfg = Debug|Win32 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|ARM.ActiveCfg = Debug|Win32 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Debug|x64.ActiveCfg = Release|x64 @@ -131,13 +103,6 @@ Global {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|x64.Build.0 = Release|x64 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|x86.ActiveCfg = Release|Win32 {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release|x86.Build.0 = Release|Win32 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|Any CPU.ActiveCfg = Release|x64 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|Any CPU.Build.0 = Release|x64 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|ARM.ActiveCfg = Release|Win32 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|x64.ActiveCfg = Release|x64 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|x64.Build.0 = Release|x64 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|x86.ActiveCfg = Release|Win32 - {8E7279F8-F801-4672-B42F-1ED2C68B16A4}.Release-JP|x86.Build.0 = Release|Win32 {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|Any CPU.Build.0 = Debug|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -154,14 +119,6 @@ Global {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|x64.Build.0 = Release|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|x86.ActiveCfg = Release|Any CPU {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release|x86.Build.0 = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|ARM.ActiveCfg = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|ARM.Build.0 = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|x64.ActiveCfg = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|x64.Build.0 = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|x86.ActiveCfg = Release|Any CPU - {4232CB4A-DFE3-46CA-9503-C5F1798BAED3}.Release-JP|x86.Build.0 = Release|Any CPU {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|Any CPU.Build.0 = Debug|Any CPU {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -178,14 +135,6 @@ Global {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|x64.Build.0 = Release|Any CPU {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|x86.ActiveCfg = Release|Any CPU {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release|x86.Build.0 = Release|Any CPU - {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release-JP|ARM.ActiveCfg = Release|Any CPU - {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release-JP|ARM.Build.0 = Release|Any CPU - {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release-JP|x64.ActiveCfg = Release|Any CPU - {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release-JP|x64.Build.0 = Release|Any CPU - {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release-JP|x86.ActiveCfg = Release|Any CPU - {CC19F9A5-01A7-4BDF-B34C-CF56F46A474A}.Release-JP|x86.Build.0 = Release|Any CPU {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Debug|Any CPU.ActiveCfg = Debug|Win32 {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Debug|ARM.ActiveCfg = Debug|ARM {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Debug|x64.ActiveCfg = Release|x64 @@ -199,14 +148,6 @@ Global {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|x64.Build.0 = Release|x64 {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|x86.ActiveCfg = Release|Win32 {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release|x86.Build.0 = Release|Win32 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release-JP|Any CPU.ActiveCfg = Release|x64 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release-JP|Any CPU.Build.0 = Release|x64 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release-JP|ARM.ActiveCfg = Release|ARM - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release-JP|ARM.Build.0 = Release|ARM - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release-JP|x64.ActiveCfg = Release|x64 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release-JP|x64.Build.0 = Release|x64 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release-JP|x86.ActiveCfg = Release|Win32 - {BD5471E5-7B55-5192-8DA4-042B66AF71AE}.Release-JP|x86.Build.0 = Release|Win32 {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|Any CPU.Build.0 = Debug|Any CPU {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -223,14 +164,6 @@ Global {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|x64.Build.0 = Release|Any CPU {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|x86.ActiveCfg = Release|Any CPU {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release|x86.Build.0 = Release|Any CPU - {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release-JP|ARM.ActiveCfg = Release|Any CPU - {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release-JP|ARM.Build.0 = Release|Any CPU - {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release-JP|x64.ActiveCfg = Release|Any CPU - {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release-JP|x64.Build.0 = Release|Any CPU - {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release-JP|x86.ActiveCfg = Release|Any CPU - {01FD66CE-F81A-4641-BE30-3CF9DE84D6D5}.Release-JP|x86.Build.0 = Release|Any CPU {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|Any CPU.Build.0 = Debug|Any CPU {1C399497-5240-439A-879A-4ACB34C409AE}.Debug|ARM.ActiveCfg = Debug|Any CPU @@ -247,14 +180,6 @@ Global {1C399497-5240-439A-879A-4ACB34C409AE}.Release|x64.Build.0 = Release|Any CPU {1C399497-5240-439A-879A-4ACB34C409AE}.Release|x86.ActiveCfg = Release|Any CPU {1C399497-5240-439A-879A-4ACB34C409AE}.Release|x86.Build.0 = Release|Any CPU - {1C399497-5240-439A-879A-4ACB34C409AE}.Release-JP|Any CPU.ActiveCfg = Release|Any CPU - {1C399497-5240-439A-879A-4ACB34C409AE}.Release-JP|Any CPU.Build.0 = Release|Any CPU - {1C399497-5240-439A-879A-4ACB34C409AE}.Release-JP|ARM.ActiveCfg = Release|Any CPU - {1C399497-5240-439A-879A-4ACB34C409AE}.Release-JP|ARM.Build.0 = Release|Any CPU - {1C399497-5240-439A-879A-4ACB34C409AE}.Release-JP|x64.ActiveCfg = Release|Any CPU - {1C399497-5240-439A-879A-4ACB34C409AE}.Release-JP|x64.Build.0 = Release|Any CPU - {1C399497-5240-439A-879A-4ACB34C409AE}.Release-JP|x86.ActiveCfg = Release|Any CPU - {1C399497-5240-439A-879A-4ACB34C409AE}.Release-JP|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/OpenCvSharp/Cv2/Cv2_calib3d.cs b/src/OpenCvSharp/Cv2/Cv2_calib3d.cs index cc98d1ba1..225e32a0a 100644 --- a/src/OpenCvSharp/Cv2/Cv2_calib3d.cs +++ b/src/OpenCvSharp/Cv2/Cv2_calib3d.cs @@ -2472,13 +2472,13 @@ public static void CalibrateRobotWorldHandEye( var R_base2gripperArray = R_base2gripper as Mat[] ?? R_base2gripper.ToArray(); var t_base2gripperArray = t_base2gripper as Mat[] ?? t_base2gripper.ToArray(); if (R_world2camArray.Length == 0) - throw new ArgumentException("Empty sequence", nameof(R_world2camArray)); + throw new ArgumentException("Empty sequence", nameof(R_world2cam)); if (t_world2camArray.Length == 0) - throw new ArgumentException("Empty sequence", nameof(t_world2camArray)); + throw new ArgumentException("Empty sequence", nameof(t_world2cam)); if (R_base2gripperArray.Length == 0) - throw new ArgumentException("Empty sequence", nameof(R_base2gripperArray)); + throw new ArgumentException("Empty sequence", nameof(R_base2gripper)); if (t_base2gripperArray.Length == 0) - throw new ArgumentException("Empty sequence", nameof(t_base2gripperArray)); + throw new ArgumentException("Empty sequence", nameof(t_base2gripper)); var R_base2worldPtrArray = R_world2camArray.Select(m => m.CvPtr).ToArray(); var t_world2camPtrArray = t_world2camArray.Select(m => m.CvPtr).ToArray(); @@ -2554,13 +2554,13 @@ public static void CalibrateRobotWorldHandEye( var R_base2gripperArray = R_base2gripper as Mat[] ?? R_base2gripper.ToArray(); var t_base2gripperArray = t_base2gripper as Mat[] ?? t_base2gripper.ToArray(); if (R_world2camArray.Length == 0) - throw new ArgumentException("Empty sequence", nameof(R_world2camArray)); + throw new ArgumentException("Empty sequence", nameof(R_world2cam)); if (t_world2camArray.Length == 0) - throw new ArgumentException("Empty sequence", nameof(t_world2camArray)); + throw new ArgumentException("Empty sequence", nameof(t_world2cam)); if (R_base2gripperArray.Length == 0) - throw new ArgumentException("Empty sequence", nameof(R_base2gripperArray)); + throw new ArgumentException("Empty sequence", nameof(R_base2gripper)); if (t_base2gripperArray.Length == 0) - throw new ArgumentException("Empty sequence", nameof(t_base2gripperArray)); + throw new ArgumentException("Empty sequence", nameof(t_base2gripper)); var R_base2worldPtrArray = R_world2camArray.Select(m => m.CvPtr).ToArray(); var t_world2camPtrArray = t_world2camArray.Select(m => m.CvPtr).ToArray(); diff --git a/src/OpenCvSharp/Cv2/Cv2_core.cs b/src/OpenCvSharp/Cv2/Cv2_core.cs index 2552fd483..dda6dee03 100644 --- a/src/OpenCvSharp/Cv2/Cv2_core.cs +++ b/src/OpenCvSharp/Cv2/Cv2_core.cs @@ -61,16 +61,6 @@ public static void CopyMakeBorder(InputArray src, OutputArray dst, int top, int dst.Fix(); } -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の和を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src1 と同じサイズ,同じ型の出力配列. - /// 8ビット,シングルチャンネル配列のオプションの処理マスク.出力配列内の変更される要素を表します. [既定値はnull] - /// -#else /// /// Computes the per-element sum of two arrays or an array and a scalar. /// @@ -79,7 +69,6 @@ public static void CopyMakeBorder(InputArray src, OutputArray dst, int top, int /// The destination array; it will have the same size and same type as src1 /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] /// -#endif public static void Add(InputArray src1, InputArray src2, OutputArray dst, InputArray? mask = null, int dtype = -1) { @@ -102,16 +91,7 @@ public static void Add(InputArray src1, InputArray src2, OutputArray dst, InputA GC.KeepAlive(mask); dst.Fix(); } -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の差を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src1 と同じサイズ,同じ型の出力配列. - /// オプション.8ビット,シングルチャンネル配列の処理マスク.出力配列内の変更される要素を表します. [既定値はnull] - /// -#else + /// /// Calculates per-element difference between two arrays or array and a scalar /// @@ -120,7 +100,6 @@ public static void Add(InputArray src1, InputArray src2, OutputArray dst, InputA /// The destination array; it will have the same size and same type as src1 /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] /// -#endif public static void Subtract(InputArray src1, InputArray src2, OutputArray dst, InputArray? mask = null, int dtype = -1) { @@ -144,16 +123,6 @@ public static void Subtract(InputArray src1, InputArray src2, OutputArray dst, I GC.KeepAlive(mask); } -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の差を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src1 と同じサイズ,同じ型の出力配列. - /// オプション.8ビット,シングルチャンネル配列の処理マスク.出力配列内の変更される要素を表します. [既定値はnull] - /// -#else /// /// Calculates per-element difference between two arrays or array and a scalar /// @@ -162,7 +131,6 @@ public static void Subtract(InputArray src1, InputArray src2, OutputArray dst, I /// The destination array; it will have the same size and same type as src1 /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] /// -#endif public static void Subtract(InputArray src1, Scalar src2, OutputArray dst, InputArray? mask = null, int dtype = -1) { @@ -184,16 +152,6 @@ public static void Subtract(InputArray src1, Scalar src2, OutputArray dst, Input GC.KeepAlive(mask); } -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の差を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src1 と同じサイズ,同じ型の出力配列. - /// オプション.8ビット,シングルチャンネル配列の処理マスク.出力配列内の変更される要素を表します. [既定値はnull] - /// -#else /// /// Calculates per-element difference between two arrays or array and a scalar /// @@ -202,7 +160,6 @@ public static void Subtract(InputArray src1, Scalar src2, OutputArray dst, Input /// The destination array; it will have the same size and same type as src1 /// The optional operation mask, 8-bit single channel array; specifies elements of the destination array to be changed. [By default this is null] /// -#endif public static void Subtract(Scalar src1, InputArray src2, OutputArray dst, InputArray? mask = null, int dtype = -1) { @@ -224,16 +181,6 @@ public static void Subtract(Scalar src1, InputArray src2, OutputArray dst, Input GC.KeepAlive(mask); } -#if LANG_JP - /// - /// 2つの配列同士の,要素毎のスケーリングされた積を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src1 と同じサイズ,同じ型の出力配列 - /// オプションであるスケールファクタ. [既定値は1] - /// -#else /// /// Calculates the per-element scaled product of two arrays /// @@ -242,7 +189,6 @@ public static void Subtract(Scalar src1, InputArray src2, OutputArray dst, Input /// The destination array; will have the same size and the same type as src1 /// The optional scale factor. [By default this is 1] /// -#endif public static void Multiply(InputArray src1, InputArray src2, OutputArray dst, double scale = 1, int dtype = -1) { if (src1 == null) @@ -264,16 +210,6 @@ public static void Multiply(InputArray src1, InputArray src2, OutputArray dst, d dst.Fix(); } -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の商を求めます. - /// - /// 1番目の入力配列 - /// src1 と同じサイズ,同じ型である2番目の入力配列 - /// src2 と同じサイズ,同じ型である出力配列 - /// スケールファクタ [既定値は1] - /// -#else /// /// Performs per-element division of two arrays or a scalar by an array. /// @@ -282,7 +218,6 @@ public static void Multiply(InputArray src1, InputArray src2, OutputArray dst, d /// The destination array; will have the same size and same type as src2 /// Scale factor [By default this is 1] /// -#endif public static void Divide(InputArray src1, InputArray src2, OutputArray dst, double scale = 1, int dtype = -1) { if (src1 == null) @@ -304,15 +239,6 @@ public static void Divide(InputArray src1, InputArray src2, OutputArray dst, dou dst.Fix(); } -#if LANG_JP - /// - /// 2つの配列同士,あるいは配列とスカラの 要素毎の商を求めます. - /// - /// スケールファクタ - /// 1番目の入力配列 - /// src2 と同じサイズ,同じ型である出力配列 - /// -#else /// /// Performs per-element division of two arrays or a scalar by an array. /// @@ -320,7 +246,6 @@ public static void Divide(InputArray src1, InputArray src2, OutputArray dst, dou /// The first source array /// The destination array; will have the same size and same type as src2 /// -#endif public static void Divide(double scale, InputArray src2, OutputArray dst, int dtype = -1) { if (src2 == null) @@ -396,15 +321,6 @@ public static void AddWeighted(InputArray src1, double alpha, InputArray src2, dst.Fix(); } -#if LANG_JP - /// - /// スケーリング後,絶対値を計算し,結果を結果を 8 ビットに変換します. - /// - /// 入力配列 - /// 出力配列 - /// オプションのスケールファクタ. [既定値は1] - /// スケーリングされた値に加えられるオプション値. [既定値は0] -#else /// /// Scales, computes absolute values and converts the result to 8-bit. /// @@ -412,7 +328,6 @@ public static void AddWeighted(InputArray src1, double alpha, InputArray src2, /// The destination array /// The optional scale factor. [By default this is 1] /// The optional delta added to the scaled values. [By default this is 0] -#endif public static void ConvertScaleAbs(InputArray src, OutputArray dst, double alpha = 1, double beta = 0) { if (src == null) @@ -3695,6 +3610,11 @@ public static MatExpr Abs(MatExpr src) /// public static int Partition(IEnumerable vec, out int[] labels, PartitionPredicate predicate) { + if (vec == null) + throw new ArgumentNullException(nameof(vec)); + if (predicate == null) + throw new ArgumentNullException(nameof(predicate)); + var vecArray = vec as T[] ?? vec.ToArray(); labels = new int[vecArray.Length]; var groupHeads = new List(); diff --git a/src/OpenCvSharp/Cv2/Cv2_cuda.cs b/src/OpenCvSharp/Cv2/Cv2_cuda.cs index 69feaad28..88acf49a0 100644 --- a/src/OpenCvSharp/Cv2/Cv2_cuda.cs +++ b/src/OpenCvSharp/Cv2/Cv2_cuda.cs @@ -10,59 +10,32 @@ static partial class Cv2 { #region Hardware -#if LANG_JP - /// - /// CUDAを利用可能なデバイスの個数を返します. - /// 最初のGPU関数呼び出しよりも前に利用しなければいけません. - /// OpenCVがGPUサポートなしでコンパイルされていれば,この関数は0を返します. - /// - /// -#else /// /// Returns the number of installed CUDA-enabled devices. /// Use this function before any other GPU functions calls. /// If OpenCV is compiled without GPU support, this function returns 0. /// /// -#endif public static int GetCudaEnabledDeviceCount() { return NativeMethods.cuda_getCudaEnabledDeviceCount(); } -#if LANG_JP - /// - /// 現在のデバイスインデックスを返します. - /// これは,SetDevice によって設定された,またはデフォルトで初期化されたデバイスです. - /// - /// -#else /// /// Returns the current device index set by SetDevice() or initialized by default. /// /// -#endif public static int GetDevice() { ThrowIfGpuNotAvailable(); return NativeMethods.cuda_getDevice(); } -#if LANG_JP - /// - /// 現在のスレッドでデバイスを設定し,それを初期化します. - /// この関数呼び出しを省略することもできますが,その場合, - /// 最初に GPU が利用される際にデフォルトデバイスが初期化されます. - /// - /// 0からはじまる,GPUデバイスのインデックス. - /// -#else /// /// Sets a device and initializes it for the current thread. /// /// System index of a GPU device starting with 0. /// -#endif public static int SetDevice(int device) { ThrowIfGpuNotAvailable(); diff --git a/src/OpenCvSharp/Cv2/Cv2_highgui.cs b/src/OpenCvSharp/Cv2/Cv2_highgui.cs index c020be34f..31fb97c3b 100644 --- a/src/OpenCvSharp/Cv2/Cv2_highgui.cs +++ b/src/OpenCvSharp/Cv2/Cv2_highgui.cs @@ -203,22 +203,13 @@ public static Rect GetWindowImageRect(string winName) NativeMethods.highgui_getWindowImageRect(winName, out var ret)); return ret; } - -#if LANG_JP - /// - /// 指定されたウィンドウ内で発生するマウスイベントに対するコールバック関数を設定する - /// - /// ウィンドウの名前 - /// 指定されたウィンドウ内でマウスイベントが発生するたびに呼ばれるデリゲート - /// -#else + /// /// Sets the callback function for mouse events occuring within the specified window. /// /// Name of the window. /// Reference to the function to be called every time mouse event occurs in the specified window. /// -#endif public static void SetMouseCallback(string windowName, MouseCallback onMouse, IntPtr userData = default) { if (string.IsNullOrEmpty(windowName)) diff --git a/src/OpenCvSharp/Cv2/Cv2_imgproc.cs b/src/OpenCvSharp/Cv2/Cv2_imgproc.cs index 150d4a2d2..87a23c1bd 100644 --- a/src/OpenCvSharp/Cv2/Cv2_imgproc.cs +++ b/src/OpenCvSharp/Cv2/Cv2_imgproc.cs @@ -507,17 +507,6 @@ public static void Laplacian( dst.Fix(); } -#if LANG_JP - /// - /// Cannyアルゴリズムを用いて,画像のエッジを検出します. - /// - /// 8ビット,シングルチャンネルの入力画像 - /// 出力されるエッジのマップ. image と同じサイズ,同じ型 - /// ヒステリシスが存在する処理の,1番目の閾値 - /// ヒステリシスが存在する処理の,2番目の閾値 - /// Sobelオペレータのアパーチャサイズ [既定値はApertureSize.Size3] - /// 画像勾配の強度を求めるために,より精度の高い L2ノルムを利用するか,L1ノルムで十分(false)かを指定します. [既定値はfalse] -#else /// /// Finds edges in an image using Canny algorithm. /// @@ -527,7 +516,6 @@ public static void Laplacian( /// The second threshold for the hysteresis procedure /// Aperture size for the Sobel operator [By default this is ApertureSize.Size3] /// Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false] -#endif public static void Canny(InputArray src, OutputArray edges, double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false) { @@ -764,19 +752,6 @@ public static Point2f[] GoodFeaturesToTrack(InputArray src, return vector.ToArray(); } -#if LANG_JP - /// - /// 標準ハフ変換を用いて,2値画像から直線を検出します. - /// - /// 8ビット,シングルチャンネルの2値入力画像.この画像は関数により書き換えられる可能性があります - /// ピクセル単位で表される投票空間の距離分解能 - /// ラジアン単位で表される投票空間の角度分解能 - /// 投票の閾値パラメータ.十分な票( > threshold )を得た直線のみが出力されます - /// マルチスケールハフ変換において,距離分解能 rho の除数となる値.[既定値は0] - /// マルチスケールハフ変換において,角度分解能 theta の除数となる値. [既定値は0] - /// 検出された直線.各直線は,2要素のベクトル (rho, theta) で表現されます. - /// rho は原点(画像の左上コーナー)からの距離, theta はラジアン単位で表される直線の回転角度です -#else /// /// Finds lines in a binary image using standard Hough transform. /// @@ -788,7 +763,6 @@ public static Point2f[] GoodFeaturesToTrack(InputArray src, /// For the multi-scale Hough transform it is the divisor for the distance resolution theta. [By default this is 0] /// The output vector of lines. Each line is represented by a two-element vector (rho, theta) . /// rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians -#endif public static LineSegmentPolar[] HoughLines( InputArray image, double rho, double theta, int threshold, double srn = 0, double stn = 0) @@ -802,19 +776,7 @@ public static LineSegmentPolar[] HoughLines( GC.KeepAlive(image); return vec.ToArray(); } - -#if LANG_JP - /// - /// 確率的ハフ変換を利用して,2値画像から線分を検出します. - /// - /// 8ビット,シングルチャンネルの2値入力画像.この画像は関数により書き換えられる可能性があります - /// ピクセル単位で表される投票空間の距離分解能 - /// ラジアン単位で表される投票空間の角度分解能 - /// 投票の閾値パラメータ.十分な票( > threshold )を得た直線のみが出力されます - /// 最小の線分長.これより短い線分は棄却されます. [既定値は0] - /// 2点が同一線分上にあると見なす場合に許容される最大距離. [既定値は0] - /// 検出された線分.各線分は,4要素のベクトル (x1, y1, x2, y2) で表現されます. -#else + /// /// Finds lines segments in a binary image using probabilistic Hough transform. /// @@ -825,7 +787,6 @@ public static LineSegmentPolar[] HoughLines( /// The minimum line length. Line segments shorter than that will be rejected. [By default this is 0] /// The maximum allowed gap between points on the same line to link them. [By default this is 0] /// The output lines. Each line is represented by a 4-element vector (x1, y1, x2, y2) -#endif public static LineSegmentPoint[] HoughLinesP( InputArray image, double rho, double theta, int threshold, double minLineLength = 0, double maxLineGap = 0) @@ -874,20 +835,6 @@ public static void HoughLinesPointSet( lines.Fix(); } -#if LANG_JP - /// - /// ハフ変換を用いて,グレースケール画像から円を検出します. - /// - /// 8ビット,シングルチャンネル,グレースケールの入力画像> - /// 現在のところ,HoughCirclesMethod.Gradient メソッドのみが実装されている. - /// 画像分解能に対する投票分解能の比率の逆数. - /// 検出される円の中心同士の最小距離. - /// 手法依存の1番目のパラメータ.[既定値は100] - /// 手法依存の2番目のパラメータ.[既定値は100] - /// 円の半径の最小値 [既定値は0] - /// 円の半径の最大値 [既定値は0] - /// 検出された円.各ベクトルは,3要素の浮動小数点型ベクトル (x, y, radius) としてエンコードされます -#else /// /// Finds circles in a grayscale image using a Hough transform. /// @@ -900,7 +847,6 @@ public static void HoughLinesPointSet( /// Minimum circle radius. [By default this is 0] /// Maximum circle radius. [By default this is 0] /// The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius) -#endif public static CircleSegment[] HoughCircles( InputArray image, HoughMethods method, double dp, double minDist, double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0) @@ -925,18 +871,6 @@ public static Scalar MorphologyDefaultBorderValue() return Scalar.All(double.MaxValue); } -#if LANG_JP - /// - /// 指定の構造要素を用いて画像の膨張を行います. - /// - /// 入力画像 - /// src と同じサイズ,同じ型の出力画像 - /// 膨張に用いられる構造要素. element=new Mat() の場合, 3x3 の矩形構造要素が用いられます - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します - /// 膨張が行われる回数. [既定値は1] - /// ピクセル外挿手法.[既定値はBorderType.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます.[既定値はCvCpp.MorphologyDefaultBorderValue()] -#else /// /// Dilates an image by using a specific structuring element. /// @@ -947,7 +881,6 @@ public static Scalar MorphologyDefaultBorderValue() /// The number of times dilation is applied. [By default this is 1] /// The pixel extrapolation method. [By default this is BorderType.Constant] /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] -#endif public static void Dilate( InputArray src, OutputArray dst, InputArray? element, Point? anchor = null, int iterations = 1, @@ -972,18 +905,6 @@ public static void Dilate( dst.Fix(); } -#if LANG_JP - /// - /// 指定の構造要素を用いて画像の収縮を行います. - /// - /// 入力画像 - /// src と同じサイズ,同じ型の出力画像 - /// 収縮に用いられる構造要素. element=new Mat() の場合, 3x3 の矩形の構造要素が用いられます - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します - /// 収縮が行われる回数. [既定値は1] - /// ピクセル外挿手法.[既定値はBorderType.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます.[既定値はCvCpp.MorphologyDefaultBorderValue()] -#else /// /// Erodes an image by using a specific structuring element. /// @@ -994,7 +915,6 @@ public static void Dilate( /// The number of times erosion is applied /// The pixel extrapolation method /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] -#endif public static void Erode( InputArray src, OutputArray dst, InputArray? element, Point? anchor = null, int iterations = 1, @@ -1019,19 +939,6 @@ public static void Erode( dst.Fix(); } -#if LANG_JP - /// - /// 高度なモルフォロジー変換を行います. - /// - /// 入力画像 - /// src と同じサイズ,同じ型の出力画像 - /// モルフォロジー演算の種類 - /// 構造要素 - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します. - /// 収縮と膨張が適用される回数. [既定値は1] - /// ピクセル外挿手法. [既定値はBorderType.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます. [既定値は CvCpp.MorphologyDefaultBorderValue()] -#else /// /// Performs advanced morphological transformations /// @@ -1043,7 +950,6 @@ public static void Erode( /// Number of times erosion and dilation are applied. [By default this is 1] /// The pixel extrapolation method. [By default this is BorderType.Constant] /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] -#endif public static void MorphologyEx( InputArray src, OutputArray dst, MorphTypes op, InputArray? element, Point? anchor = null, int iterations = 1, diff --git a/src/OpenCvSharp/Cv2/Cv2_photo.cs b/src/OpenCvSharp/Cv2/Cv2_photo.cs index 5f71f9a40..2f5e50a56 100644 --- a/src/OpenCvSharp/Cv2/Cv2_photo.cs +++ b/src/OpenCvSharp/Cv2/Cv2_photo.cs @@ -318,7 +318,7 @@ public static void Decolor( /// Output image with the same size and type as dst. /// Cloning method public static void SeamlessClone( - InputArray src, InputArray dst, InputArray mask, Point p, + InputArray src, InputArray dst, InputArray? mask, Point p, OutputArray blend, SeamlessCloneMethods flags) { if (src == null) @@ -329,7 +329,7 @@ public static void SeamlessClone( throw new ArgumentNullException(nameof(blend)); src.ThrowIfDisposed(); dst.ThrowIfDisposed(); - mask.ThrowIfDisposed(); + mask?.ThrowIfDisposed(); blend.ThrowIfNotReady(); NativeMethods.HandleException( @@ -353,7 +353,7 @@ public static void SeamlessClone( /// G-channel multiply factor. /// B-channel multiply factor. public static void ColorChange( - InputArray src, InputArray mask, OutputArray dst, + InputArray src, InputArray? mask, OutputArray dst, float redMul = 1.0f, float greenMul = 1.0f, float blueMul = 1.0f) { if (src == null) @@ -362,7 +362,7 @@ public static void ColorChange( throw new ArgumentNullException(nameof(dst)); src.ThrowIfDisposed(); dst.ThrowIfNotReady(); - mask.ThrowIfDisposed(); + mask?.ThrowIfDisposed(); NativeMethods.HandleException( NativeMethods.photo_colorChange( @@ -387,7 +387,7 @@ public static void ColorChange( /// This is useful to highlight under-exposed foreground objects or to reduce specular reflections. /// public static void IlluminationChange( - InputArray src, InputArray mask, OutputArray dst, + InputArray src, InputArray? mask, OutputArray dst, float alpha = 0.2f, float beta = 0.4f) { if (src == null) @@ -397,7 +397,7 @@ public static void IlluminationChange( src.ThrowIfDisposed(); dst.ThrowIfNotReady(); - mask.ThrowIfDisposed(); + mask?.ThrowIfDisposed(); NativeMethods.HandleException( NativeMethods.photo_illuminationChange( @@ -420,7 +420,7 @@ public static void IlluminationChange( /// Value > 100. /// The size of the Sobel kernel to be used. public static void TextureFlattening( - InputArray src, InputArray mask, OutputArray dst, + InputArray src, InputArray? mask, OutputArray dst, float lowThreshold = 30, float highThreshold = 45, int kernelSize = 3) { @@ -431,7 +431,7 @@ public static void TextureFlattening( src.ThrowIfDisposed(); dst.ThrowIfNotReady(); - mask.ThrowIfDisposed(); + mask?.ThrowIfDisposed(); NativeMethods.HandleException( NativeMethods.photo_textureFlattening( diff --git a/src/OpenCvSharp/Fundamentals/Ptr.cs b/src/OpenCvSharp/Fundamentals/Ptr.cs index 7aa5279ff..1e4a3dff2 100644 --- a/src/OpenCvSharp/Fundamentals/Ptr.cs +++ b/src/OpenCvSharp/Fundamentals/Ptr.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; namespace OpenCvSharp { @@ -15,10 +16,11 @@ protected Ptr(IntPtr ptr) { this.ptr = ptr; } - + /// /// Returns Ptr<T>.get() pointer /// + [SuppressMessage("Microsoft.Design", "CA1716: Identifiers should not match keywords")] public abstract IntPtr Get(); } } diff --git a/src/OpenCvSharp/Fundamentals/ResourcesTracker.cs b/src/OpenCvSharp/Fundamentals/ResourcesTracker.cs index 782b06411..62c85bd12 100644 --- a/src/OpenCvSharp/Fundamentals/ResourcesTracker.cs +++ b/src/OpenCvSharp/Fundamentals/ResourcesTracker.cs @@ -6,10 +6,10 @@ namespace OpenCvSharp /// /// Used for managing the resources of OpenCVSharp, like Mat, MatExpr, etc. /// - public class ResourcesTracker : IDisposable + public sealed class ResourcesTracker : IDisposable { private readonly ISet trackedObjects = new HashSet(); - private readonly object asyncLock = new object(); + private readonly object asyncLock = new (); /// /// Trace the object obj, and return it @@ -39,6 +39,9 @@ public TCvObject T(TCvObject obj) public TCvObject[] T(TCvObject[] objects) where TCvObject : DisposableObject { + if (objects == null) + throw new ArgumentNullException(nameof(objects)); + foreach (var obj in objects) { T(obj); diff --git a/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs b/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs index 2c0b774b5..155f4f73b 100644 --- a/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs +++ b/src/OpenCvSharp/Internal/PInvoke/WindowsLibraryLoader.cs @@ -8,6 +8,8 @@ using System.Runtime.InteropServices; using System.Text; +#pragma warning disable 1591 + namespace OpenCvSharp.Internal { /// @@ -16,14 +18,7 @@ namespace OpenCvSharp.Internal /// This code is based on https://github.com/charlesw/tesseract public sealed class WindowsLibraryLoader { - #region Singleton pattern - - /// - /// - /// - public static WindowsLibraryLoader Instance { get; } = new WindowsLibraryLoader(); - - #endregion + public static WindowsLibraryLoader Instance { get; } = new(); /// /// The default base directory name to copy the assemblies too. @@ -32,13 +27,13 @@ public sealed class WindowsLibraryLoader private const string DllFileExtension = ".dll"; private const string DllDirectory = "dll"; - private readonly List loadedAssemblies = new List(); + private readonly List loadedAssemblies = new(); /// /// Map processor /// private readonly Dictionary processorArchitecturePlatforms = - new Dictionary(StringComparer.OrdinalIgnoreCase) + new (StringComparer.OrdinalIgnoreCase) { {"x86", "x86"}, {"AMD64", "x64"}, @@ -50,7 +45,7 @@ public sealed class WindowsLibraryLoader /// Used as a sanity check for the returned processor architecture to double check the returned value. /// private readonly Dictionary processorArchitectureAddressWidthPlatforms = - new Dictionary(StringComparer.OrdinalIgnoreCase) + new(StringComparer.OrdinalIgnoreCase) { {"x86", 4}, {"AMD64", 8}, @@ -63,7 +58,7 @@ public sealed class WindowsLibraryLoader /// public List AdditionalPaths { get; } - private readonly object syncLock = new object(); + private readonly object syncLock = new(); /// /// constructor @@ -373,7 +368,7 @@ public ProcessArchitectureInfo() public void AddWarning(string format, params object[] args) { - Warnings.Add(string.Format(format, args)); + Warnings.Add(string.Format(CultureInfo.InvariantCulture, format, args)); } public string WarningText() diff --git a/src/OpenCvSharp/Internal/Util/ArrayAddress.cs b/src/OpenCvSharp/Internal/Util/ArrayAddress.cs index 10c533269..65c2b79f1 100644 --- a/src/OpenCvSharp/Internal/Util/ArrayAddress.cs +++ b/src/OpenCvSharp/Internal/Util/ArrayAddress.cs @@ -17,30 +17,18 @@ public class ArrayAddress1 : DisposableObject { private readonly Array array; private GCHandle gch; - - /// - /// - /// - /// + public ArrayAddress1(T[] array) { - this.array = array ?? throw new ArgumentNullException(); + this.array = array ?? throw new ArgumentNullException(nameof(array)); gch = GCHandle.Alloc(array, GCHandleType.Pinned); } - - /// - /// - /// - /// + public ArrayAddress1(IEnumerable enumerable) : this(enumerable.ToArray()) { } - - /// - /// - /// - /// + public ArrayAddress1(T[,] array) { this.array = array ?? throw new ArgumentNullException(nameof(array)); @@ -58,15 +46,9 @@ protected override void DisposeUnmanaged() } base.DisposeUnmanaged(); } - - /// - /// - /// + public IntPtr Pointer => gch.AddrOfPinnedObject(); - - /// - /// - /// + public int Length => array.Length; } } \ No newline at end of file diff --git a/src/OpenCvSharp/Internal/Util/PInvokeHelper.cs b/src/OpenCvSharp/Internal/Util/PInvokeHelper.cs index 4d6eb5877..446d412cb 100644 --- a/src/OpenCvSharp/Internal/Util/PInvokeHelper.cs +++ b/src/OpenCvSharp/Internal/Util/PInvokeHelper.cs @@ -42,6 +42,9 @@ public static void DllImportError(Exception ex) /// public static OpenCvSharpException CreateException(Exception ex) { + if (ex == null) + throw new ArgumentNullException(nameof(ex)); + /*StringBuilder message = new StringBuilder(); if (System.Globalization.CultureInfo.CurrentCulture.Name.Contains("ja")) { diff --git a/src/OpenCvSharp/Internal/Util/ScopedGCHandle.cs b/src/OpenCvSharp/Internal/Util/ScopedGCHandle.cs index a688a5b62..6ae576078 100644 --- a/src/OpenCvSharp/Internal/Util/ScopedGCHandle.cs +++ b/src/OpenCvSharp/Internal/Util/ScopedGCHandle.cs @@ -1,36 +1,23 @@ using System; using System.Runtime.InteropServices; +#pragma warning disable 1591 + namespace OpenCvSharp.Internal.Util { -#if LANG_JP - /// - /// IDisposableを実装したGCHandle - /// -#else /// /// Original GCHandle that implement IDisposable /// -#endif // ReSharper disable once InconsistentNaming - public class ScopedGCHandle : IDisposable + public sealed class ScopedGCHandle : IDisposable { private GCHandle handle; private bool disposed; - #region Init and Disposal - -#if LANG_JP /// - /// 指定したオブジェクトに System.Runtime.InteropServices.GCHandleType.Normal ハンドルを割り当てます - /// - /// GCの対象からはずすオブジェクト -#else - /// - /// + /// Constructor /// /// -#endif public ScopedGCHandle(object value) { if (value == null) @@ -39,19 +26,11 @@ public ScopedGCHandle(object value) disposed = false; } -#if LANG_JP /// - /// 指定したオブジェクトに指定した型のハンドルを割り当てます - /// - /// GCの対象からはずすオブジェクト - /// 作成する System.Runtime.InteropServices.GCHandle の型を示す、System.Runtime.InteropServices.GCHandleType 値の 1 つ -#else - /// - /// + /// Constructor /// /// /// -#endif public ScopedGCHandle(object value, GCHandleType type) { if (value == null) @@ -60,91 +39,20 @@ public ScopedGCHandle(object value, GCHandleType type) disposed = false; } -#if LANG_JP - /// - /// GCHandleから初期化 - /// - /// -#else /// - /// + /// Constructor /// /// -#endif private ScopedGCHandle(GCHandle handle) { this.handle = handle; disposed = false; } - -#if LANG_JP - /// - /// 指定したオブジェクトに System.Runtime.InteropServices.GCHandleType.Normal ハンドルを割り当てます - /// - /// System.Runtime.InteropServices.GCHandle を使用するオブジェクト - /// オブジェクトをガベージ コレクションから保護する新しい System.Runtime.InteropServices.GCHandle。 - /// System.Runtime.InteropServices.GCHandle は、不要になったときに System.Runtime.InteropServices.GCHandle.Free() で解放する必要があります。 - /// 非プリミティブ (blittable でない) メンバを持つインスタンスは固定できません -#else - /// - /// - /// - /// - /// -#endif - public static ScopedGCHandle Alloc(object value) - { - return new ScopedGCHandle(value); - } - -#if LANG_JP - /// - /// 指定したオブジェクトに指定した型のハンドルを割り当てます - /// - /// System.Runtime.InteropServices.GCHandle を使用するオブジェクト - /// 作成する System.Runtime.InteropServices.GCHandle の型を示す、System.Runtime.InteropServices.GCHandleType 値の 1 つ - /// オブジェクトをガベージ コレクションから保護する新しい System.Runtime.InteropServices.GCHandle。 - /// System.Runtime.InteropServices.GCHandle は、不要になったときに System.Runtime.InteropServices.GCHandle.Free() で解放する必要があります。 - /// 非プリミティブ (blittable でない) メンバを持つインスタンスは固定できません -#else - /// - /// - /// - /// - /// - /// -#endif - public static ScopedGCHandle Alloc(object value, GCHandleType type) - { - return new ScopedGCHandle(value, type); - } - -#if LANG_JP - /// - /// GCHandle.Freeによりリソースの解放を行う - /// -#else - /// - /// - /// -#endif + public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// - /// - /// - protected virtual void Dispose(bool disposing) { if (!disposed) { - if (disposing) - { - } // Release managed resources. if (handle.IsAllocated) { @@ -153,148 +61,34 @@ protected virtual void Dispose(bool disposing) disposed = true; } } - - /// - /// Destructor - /// - ~ScopedGCHandle() - { - Dispose(false); - } - #endregion - - #region Static methods -#if LANG_JP - /// - /// マネージ オブジェクトを識別するハンドルから作成された新しい System.Runtime.InteropServices.GCHandle オブジェクトを返します - /// - /// System.Runtime.InteropServices.GCHandle オブジェクトの作成元のマネージ オブジェクトを識別する System.IntPtr ハンドル - /// value パラメータの値が System.IntPtr.Zero です - /// 値パラメータに対応する新しい System.Runtime.InteropServices.GCHandle オブジェクト -#else - /// - /// - /// - /// - /// -#endif + public static ScopedGCHandle FromIntPtr(IntPtr value) { return new ScopedGCHandle(GCHandle.FromIntPtr(value)); } -#if LANG_JP - /// - /// System.Runtime.InteropServices.GCHandle オブジェクトの内部整数表現を返します - /// - /// 内部整数表現の取得元の System.Runtime.InteropServices.GCHandle オブジェクト - /// System.Runtime.InteropServices.GCHandle オブジェクトを表す System.IntPtr オブジェクト -#else - /// - /// - /// - /// - /// -#endif public static IntPtr ToIntPtr(ScopedGCHandle value) { - return GCHandle.ToIntPtr(value.Handle); - } - #endregion - - #region Properties -#if LANG_JP - /// - /// 内部で保持するGCHandle - /// -#else - /// - /// - /// -#endif - public GCHandle Handle - { - get { return handle; } - } + if (value == null) + throw new ArgumentNullException(nameof(value)); -#if LANG_JP - /// - /// ハンドルが割り当てられているかどうかを示す値を取得します - /// -#else - /// - /// - /// -#endif - public bool IsAllocated - { - get { return handle.IsAllocated; } + return GCHandle.ToIntPtr(value.Handle); } -#if LANG_JP - /// - /// ハンドルが表すオブジェクトを取得または設定します - /// -#else - /// - /// - /// -#endif - public object? Target - { - get { return handle.Target; } - } + public GCHandle Handle => handle; - #endregion + public bool IsAllocated => handle.IsAllocated; - #region Methods + public object? Target => handle.Target; -#if LANG_JP - /// - /// System.Runtime.InteropServices.GCHandleType.Pinned ハンドル内のオブジェクトのアドレスを取得します - /// - /// System.IntPtr としての Pinned オブジェクトのアドレス -#else - /// - /// - /// - /// -#endif - public IntPtr AddrOfPinnedObject() - { - return handle.AddrOfPinnedObject(); - } - -#if LANG_JP - /// - /// System.Runtime.InteropServices.GCHandle を解放します - /// -#else - /// - /// - /// -#endif public void Free() { handle.Free(); } -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// -#else - /// - /// - /// - /// -#endif public override string? ToString() { return handle.ToString(); } - - #endregion } } diff --git a/src/OpenCvSharp/Modules/aruco/CvAruco.cs b/src/OpenCvSharp/Modules/aruco/CvAruco.cs index f35da65a9..454290ab3 100644 --- a/src/OpenCvSharp/Modules/aruco/CvAruco.cs +++ b/src/OpenCvSharp/Modules/aruco/CvAruco.cs @@ -37,6 +37,8 @@ public static void DetectMarkers( throw new ArgumentNullException(nameof(image)); if (dictionary == null) throw new ArgumentNullException(nameof(dictionary)); + if (parameters == null) + throw new ArgumentNullException(nameof(parameters)); if (dictionary.ObjectPtr == null) throw new ArgumentException($"{nameof(dictionary)} is disposed", nameof(dictionary)); diff --git a/src/OpenCvSharp/Modules/aruco/DetectorParameters.cs b/src/OpenCvSharp/Modules/aruco/DetectorParameters.cs index 96a8fea13..6ad28a351 100644 --- a/src/OpenCvSharp/Modules/aruco/DetectorParameters.cs +++ b/src/OpenCvSharp/Modules/aruco/DetectorParameters.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using OpenCvSharp.Internal; @@ -303,6 +304,7 @@ public bool DetectInvertedMarker #pragma warning disable CA1051 #pragma warning disable 1591 [StructLayout(LayoutKind.Sequential)] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct NativeStruct { public int adaptiveThreshWinSizeMin; diff --git a/src/OpenCvSharp/Modules/core/FileNodeIterator.cs b/src/OpenCvSharp/Modules/core/FileNodeIterator.cs index 729feba87..ed43fd0d9 100644 --- a/src/OpenCvSharp/Modules/core/FileNodeIterator.cs +++ b/src/OpenCvSharp/Modules/core/FileNodeIterator.cs @@ -136,12 +136,14 @@ public FileNodeIterator ReadRaw(string fmt, byte[] vec, long maxCount = int.MaxV GC.KeepAlive(this); return this; } + +#pragma warning disable 1591 - /// - /// - /// - /// - /// + public override bool Equals(object obj) + { + return Equals(obj as FileNodeIterator); + } + public bool Equals(FileNodeIterator? it) { if (it is null) @@ -157,12 +159,7 @@ public bool Equals(FileNodeIterator? it) return ret != 0; } - - /// - /// - /// - /// - /// + public long Minus(FileNodeIterator it) { if (it == null) @@ -178,12 +175,7 @@ public long Minus(FileNodeIterator it) return ret.ToInt64(); } - - /// - /// - /// - /// - /// + public bool LessThan(FileNodeIterator it) { if (it == null) @@ -199,5 +191,7 @@ public bool LessThan(FileNodeIterator it) return ret != 0; } + +#pragma warning restore 1591 } } diff --git a/src/OpenCvSharp/Modules/core/InputArray.cs b/src/OpenCvSharp/Modules/core/InputArray.cs index 6d924140a..7159576de 100644 --- a/src/OpenCvSharp/Modules/core/InputArray.cs +++ b/src/OpenCvSharp/Modules/core/InputArray.cs @@ -306,7 +306,7 @@ protected override void DisposeUnmanaged() /// public static InputArray Create(Mat mat) { - return new InputArray(mat); + return new(mat); } /// @@ -316,7 +316,7 @@ public static InputArray Create(Mat mat) /// public static InputArray Create(UMat mat) { - return new InputArray(mat); + return new(mat); } /// @@ -326,7 +326,7 @@ public static InputArray Create(UMat mat) /// public static InputArray Create(MatExpr expr) { - return new InputArray(expr); + return new(expr); } /// @@ -336,7 +336,7 @@ public static InputArray Create(MatExpr expr) /// public static InputArray Create(Scalar val) { - return new InputArray(val); + return new(val); } /// @@ -346,7 +346,7 @@ public static InputArray Create(Scalar val) /// public static InputArray Create(double val) { - return new InputArray(val); + return new(val); } #if ENABLED_CUDA @@ -368,7 +368,7 @@ public static InputArray Create(GpuMat mat) /// public static InputArray Create(IEnumerable matVector) { - return new InputArray(matVector); + return new(matVector); } /// @@ -638,89 +638,51 @@ private static MatType EstimateType(Type t) #region Cast - /// - /// - /// - /// - /// +#pragma warning disable 1591 +#pragma warning disable CA2225 + public static implicit operator InputArray(Mat mat) { return Create(mat); } - - /// - /// - /// - /// - /// + public static implicit operator InputArray(UMat mat) { return Create(mat); } - - /// - /// - /// - /// - /// + public static implicit operator InputArray(MatExpr expr) { return Create(expr); } - - /// - /// - /// - /// - /// + public static implicit operator InputArray(Scalar val) { return Create(val); } - - /// - /// - /// - /// - /// + public static implicit operator InputArray(double val) { return Create(val); } #if ENABLED_CUDA - /// - /// - /// - /// - /// public static implicit operator InputArray(GpuMat mat) { return Create(mat); } #endif - - /// - /// - /// - /// - /// + public static explicit operator InputArray(List mats) { return Create(mats); } - - /// - /// - /// - /// - /// + public static explicit operator InputArray(Mat[] mats) { return Create(mats); } -#pragma warning disable 1591 public static implicit operator InputArray(Vec2b vec) { return Create(vec); } public static implicit operator InputArray(Vec3b vec) { return Create(vec); } public static implicit operator InputArray(Vec4b vec) { return Create(vec); } @@ -745,12 +707,13 @@ public static explicit operator InputArray(Mat[] mats) public static implicit operator InputArray(Vec3d vec) { return Create(vec); } public static implicit operator InputArray(Vec4d vec) { return Create(vec); } public static implicit operator InputArray(Vec6d vec) { return Create(vec); } +#pragma warning restore CA2225 #pragma warning restore 1591 #endregion #region Methods - + /// /// /// diff --git a/src/OpenCvSharp/Modules/core/InputOutputArray.cs b/src/OpenCvSharp/Modules/core/InputOutputArray.cs index ce2a4eb9e..7df0831ef 100644 --- a/src/OpenCvSharp/Modules/core/InputOutputArray.cs +++ b/src/OpenCvSharp/Modules/core/InputOutputArray.cs @@ -1,4 +1,6 @@  +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { /// @@ -8,7 +10,7 @@ namespace OpenCvSharp public class InputOutputArray : OutputArray { /// - /// + /// Constructor /// /// internal InputOutputArray(Mat mat) @@ -17,7 +19,7 @@ internal InputOutputArray(Mat mat) } /// - /// + /// Constructor /// /// internal InputOutputArray(UMat mat) @@ -30,19 +32,29 @@ internal InputOutputArray(UMat mat) /// /// /// - public static new InputOutputArray Create(Mat mat) + public new static InputOutputArray Create(Mat mat) + { + return new(mat); + } + + /// + /// Creates a proxy class of the specified UMat + /// + /// + /// + public new static InputOutputArray Create(UMat mat) { - return new InputOutputArray(mat); + return new(mat); } /// /// /// /// - /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static implicit operator InputOutputArray(Mat mat) { - return new InputOutputArray(mat); + return new(mat); } /// @@ -50,9 +62,10 @@ public static implicit operator InputOutputArray(Mat mat) /// /// /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static implicit operator InputOutputArray(UMat mat) { - return new InputOutputArray(mat); + return new(mat); } } } diff --git a/src/OpenCvSharp/Modules/core/Mat/MatIndexer.cs b/src/OpenCvSharp/Modules/core/Mat/MatIndexer.cs index 74a78934f..c83ea60fd 100644 --- a/src/OpenCvSharp/Modules/core/Mat/MatIndexer.cs +++ b/src/OpenCvSharp/Modules/core/Mat/MatIndexer.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; namespace OpenCvSharp { @@ -37,6 +38,7 @@ public abstract class MatIndexer where T : struct /// /// Array of Mat::dims indices. /// A value to the specified array element. + [SuppressMessage("Microsoft.Design", "CA1043: Use integral or string argument for indexers")] public abstract T this[params int[] idx] { get; set; } /// diff --git a/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs b/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs index b41e39136..bc3ece03e 100644 --- a/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs +++ b/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; namespace OpenCvSharp { @@ -720,6 +721,7 @@ public Mat Reshape(params int[] newDims) /// /// Extracted submatrix specified as a rectangle. /// + [SuppressMessage("Microsoft.Design", "CA1043: Use integral or string argument for indexers")] public new Mat this[Rect roi] { get diff --git a/src/OpenCvSharp/Modules/core/MatExpr.cs b/src/OpenCvSharp/Modules/core/MatExpr.cs index d2a9b04e5..7358a6e7a 100644 --- a/src/OpenCvSharp/Modules/core/MatExpr.cs +++ b/src/OpenCvSharp/Modules/core/MatExpr.cs @@ -155,9 +155,7 @@ public static MatExpr FromMat(Mat mat) GC.KeepAlive(m); return new MatExpr(ret); } - - public MatExpr Add(Mat m) => this + m; - + public static MatExpr operator +(Mat m, MatExpr e) { if (m == null) @@ -214,6 +212,10 @@ public static MatExpr FromMat(Mat mat) return new MatExpr(ret); } + public MatExpr Add(Mat m) => this + m; + public MatExpr Add(MatExpr me) => this + me; + public MatExpr Add(Scalar s) => this + s; + public static MatExpr operator -(MatExpr e, Mat m) { if (e == null) @@ -229,9 +231,7 @@ public static MatExpr FromMat(Mat mat) GC.KeepAlive(m); return new MatExpr(ret); } - - public MatExpr Subtract(Mat m) => this - m; - + public static MatExpr operator -(Mat m, MatExpr e) { if (m == null) @@ -288,6 +288,10 @@ public static MatExpr FromMat(Mat mat) return new MatExpr(ret); } + public MatExpr Subtract(Mat m) => this - m; + public MatExpr Subtract(MatExpr me) => this - me; + public MatExpr Subtract(Scalar s) => this - s; + public static MatExpr operator *(MatExpr e, Mat m) { if (e == null) @@ -304,8 +308,6 @@ public static MatExpr FromMat(Mat mat) return new MatExpr(ret); } - public MatExpr Multiply(Mat m) => this * m; - public static MatExpr operator *(Mat m, MatExpr e) { if (m == null) @@ -362,6 +364,10 @@ public static MatExpr FromMat(Mat mat) return new MatExpr(ret); } + public MatExpr Multiply(Mat m) => this * m; + public MatExpr Multiply(MatExpr me) => this * me; + public MatExpr Multiply(double s) => this * s; + public static MatExpr operator /(MatExpr e, Mat m) { if (e == null) @@ -377,9 +383,7 @@ public static MatExpr FromMat(Mat mat) GC.KeepAlive(m); return new MatExpr(ret); } - - public MatExpr Divide(Mat m) => this / m; - + public static MatExpr operator /(Mat m, MatExpr e) { if (m == null) @@ -435,6 +439,11 @@ public static MatExpr FromMat(Mat mat) GC.KeepAlive(e2); return new MatExpr(ret); } + + public MatExpr Divide(Mat m) => this / m; + public MatExpr Divide(MatExpr me) => this / me; + public MatExpr Divide(double s) => this / s; + #pragma warning restore 1591 #endregion diff --git a/src/OpenCvSharp/Modules/core/MatExprRowColIndexer.cs b/src/OpenCvSharp/Modules/core/MatExprRowColIndexer.cs index c86435bd6..2ac95809b 100644 --- a/src/OpenCvSharp/Modules/core/MatExprRowColIndexer.cs +++ b/src/OpenCvSharp/Modules/core/MatExprRowColIndexer.cs @@ -1,4 +1,6 @@ -namespace OpenCvSharp +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp { /// /// @@ -30,6 +32,7 @@ protected internal MatExprRowColIndexer(MatExpr parent) /// /// /// + [SuppressMessage("Microsoft.Design", "CA1716: Identifiers should not match keywords")] public virtual MatExpr Get(int pos) { return this[pos]; diff --git a/src/OpenCvSharp/Modules/core/OutputArray.cs b/src/OpenCvSharp/Modules/core/OutputArray.cs index 159ed885e..23d71647c 100644 --- a/src/OpenCvSharp/Modules/core/OutputArray.cs +++ b/src/OpenCvSharp/Modules/core/OutputArray.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using OpenCvSharp.Internal; using OpenCvSharp.Internal.Vectors; @@ -96,9 +97,10 @@ protected override void DisposeUnmanaged() /// /// /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static implicit operator OutputArray(Mat mat) { - return new OutputArray(mat); + return new(mat); } /// @@ -106,9 +108,10 @@ public static implicit operator OutputArray(Mat mat) /// /// /// + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static implicit operator OutputArray(UMat umat) { - return new OutputArray(umat); + return new(umat); } #if ENABLED_CUDA @@ -244,7 +247,17 @@ public void ThrowIfNotReady() /// public static OutputArray Create(Mat mat) { - return new OutputArray(mat); + return new (mat); + } + + /// + /// Creates a proxy class of the specified matrix + /// + /// + /// + public static OutputArray Create(UMat mat) + { + return new (mat); } #if ENABLED_CUDA diff --git a/src/OpenCvSharp/Modules/core/RNG_MT19937.cs b/src/OpenCvSharp/Modules/core/RNG_MT19937.cs index 7f27e165a..68a12603d 100644 --- a/src/OpenCvSharp/Modules/core/RNG_MT19937.cs +++ b/src/OpenCvSharp/Modules/core/RNG_MT19937.cs @@ -1,10 +1,13 @@ -namespace OpenCvSharp +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp { /// /// Mersenne Twister random number generator /// /// operations.hpp // ReSharper disable once InconsistentNaming + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct RNG_MT19937 { private const int N = 624, M = 397; diff --git a/src/OpenCvSharp/Modules/core/SparseMat.cs b/src/OpenCvSharp/Modules/core/SparseMat.cs index 09a7af6df..feafd63f9 100644 --- a/src/OpenCvSharp/Modules/core/SparseMat.cs +++ b/src/OpenCvSharp/Modules/core/SparseMat.cs @@ -193,6 +193,8 @@ public SparseMat Clone() /// public void CopyTo(SparseMat m) { + if (m == null) + throw new ArgumentNullException(nameof(m)); ThrowIfDisposed(); NativeMethods.HandleException( @@ -208,6 +210,8 @@ public void CopyTo(SparseMat m) /// public void CopyTo(Mat m) { + if (m == null) + throw new ArgumentNullException(nameof(m)); ThrowIfDisposed(); NativeMethods.HandleException( @@ -225,6 +229,8 @@ public void CopyTo(Mat m) /// public void ConvertTo(SparseMat m, int rtype, double alpha = 1) { + if (m == null) + throw new ArgumentNullException(nameof(m)); ThrowIfDisposed(); NativeMethods.HandleException( @@ -243,6 +249,8 @@ public void ConvertTo(SparseMat m, int rtype, double alpha = 1) /// The optional delta added to the scaled values before the conversion public void ConvertTo(Mat m, int rtype, double alpha = 1, double beta = 0) { + if (m == null) + throw new ArgumentNullException(nameof(m)); ThrowIfDisposed(); NativeMethods.HandleException( @@ -259,6 +267,8 @@ public void ConvertTo(Mat m, int rtype, double alpha = 1, double beta = 0) /// public void AssignTo(SparseMat m, int type = -1) { + if (m == null) + throw new ArgumentNullException(nameof(m)); ThrowIfDisposed(); NativeMethods.HandleException( diff --git a/src/OpenCvSharp/Modules/core/Struct/DMatch.cs b/src/OpenCvSharp/Modules/core/Struct/DMatch.cs index 3d7227868..2ec32dd5d 100644 --- a/src/OpenCvSharp/Modules/core/Struct/DMatch.cs +++ b/src/OpenCvSharp/Modules/core/Struct/DMatch.cs @@ -1,52 +1,30 @@ -namespace OpenCvSharp +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp { #pragma warning disable CA1051 -#if LANG_JP - /// - /// 2つのキーポイントディスクリプタ同士のマッチング情報 - /// -#else /// /// Struct for matching: query descriptor index, train descriptor index, train image index and distance between descriptors. /// -#endif + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct DMatch { -#if LANG_JP - /// - /// クエリディスクリプタインデックス - /// -#else /// /// query descriptor index /// -#endif public int QueryIdx; -#if LANG_JP - /// - /// 訓練ディスクリプタインデックス - /// -#else /// /// train descriptor index /// -#endif public int TrainIdx; -#if LANG_JP - /// - /// 訓練画像インデックス - /// -#else /// /// train image index /// -#endif public int ImgIdx; - - + /// /// /// @@ -58,11 +36,11 @@ public struct DMatch /// public static DMatch Empty() { - return new DMatch(-1, -1, -1, float.MaxValue); + return new (-1, -1, -1, float.MaxValue); } /// - /// + /// Constructor /// /// /// @@ -73,7 +51,7 @@ public DMatch(int queryIdx, int trainIdx, float distance) : } /// - /// + /// Constructor /// /// /// @@ -110,25 +88,26 @@ public DMatch(int queryIdx, int trainIdx, int imgIdx, float distance) } /// - /// + /// Compares by distance (less is better) /// - /// + /// /// - public static explicit operator Vec4f(DMatch self) - { - return new Vec4f(self.QueryIdx, self.TrainIdx, self.ImgIdx, self.Distance); - } + public int CompareTo(DMatch other) => Distance.CompareTo(other.Distance); + +#pragma warning disable 1591 + + public static explicit operator Vec4f(DMatch self) => self.ToVec4f(); + + // ReSharper disable once InconsistentNaming + public Vec4f ToVec4f() => new(QueryIdx, TrainIdx, ImgIdx, Distance); + + public static explicit operator DMatch(Vec4f v) => FromVec4f(v); + + // ReSharper disable once InconsistentNaming + public static DMatch FromVec4f(Vec4f v) => new ((int)v.Item0, (int)v.Item1, (int)v.Item2, v.Item3); + +#pragma warning restore 1591 - /// - /// - /// - /// - /// - public static explicit operator DMatch(Vec4f v) - { - return new DMatch((int)v.Item0, (int)v.Item1, (int)v.Item2, v.Item3); - } - /// public override readonly string ToString() { diff --git a/src/OpenCvSharp/Modules/core/Struct/Point.cs b/src/OpenCvSharp/Modules/core/Struct/Point.cs index 10d59d4d5..f914b0207 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point.cs @@ -45,26 +45,20 @@ public Point(double x, double y) } #region Cast + +#pragma warning disable 1591 - /// - /// - /// - /// - /// - public static implicit operator Vec2i(Point point) - { - return new Vec2i(point.X, point.Y); - } + // ReSharper disable once InconsistentNaming + public readonly Vec2i ToVec2i() => new(X, Y); - /// - /// - /// - /// - /// - public static implicit operator Point(Vec2i vec) - { - return new Point(vec.Item0, vec.Item1); - } + public static implicit operator Vec2i(Point point) => point.ToVec2i(); + + // ReSharper disable once InconsistentNaming + public static Point FromVec2i(Vec2i vec) => new(vec.Item0, vec.Item1); + + public static implicit operator Point(Vec2i vec) => FromVec2i(vec); + +#pragma warning restore 1591 #endregion @@ -115,109 +109,84 @@ public static implicit operator Point(Vec2i vec) #endregion #region + / - + + /// + /// Unary plus operator + /// + /// + public readonly Point Plus() => this; -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else /// /// Unary plus operator /// /// /// -#endif - public static Point operator +(Point pt) - { - return pt; - } + public static Point operator +(Point pt) => pt; + + /// + /// Unary minus operator + /// + /// + public readonly Point Negate() => new(-X, -Y); -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else /// /// Unary minus operator /// /// /// -#endif - public static Point operator -(Point pt) - { - return new Point(-pt.X, -pt.Y); - } + public static Point operator -(Point pt) => pt.Negate(); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point Add(Point p) => new(X + p.X, Y + p.Y); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point operator +(Point p1, Point p2) - { - return new Point(p1.X + p2.X, p1.Y + p2.Y); - } + public static Point operator +(Point p1, Point p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point Subtract(Point p) => new(X - p.X, Y - p.Y); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point operator -(Point p1, Point p2) - { - return new Point(p1.X - p2.X, p1.Y - p2.Y); - } + public static Point operator -(Point p1, Point p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point Multiply(double scale) => new(X * scale, Y * scale); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point operator *(Point pt, double scale) - { - return new Point((int) (pt.X*scale), (int) (pt.Y*scale)); - } + public static Point operator *(Point pt, double scale) => pt.Multiply(scale); #endregion #endregion #region Override - + /// public readonly bool Equals(Point other) { diff --git a/src/OpenCvSharp/Modules/core/Struct/Point2d.cs b/src/OpenCvSharp/Modules/core/Struct/Point2d.cs index 749e8abd5..b73cdaeba 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point2d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point2d.cs @@ -35,45 +35,28 @@ public Point2d(double x, double y) #region Cast - /// - /// - /// - /// - /// - public static explicit operator Point(Point2d self) - { - return new Point((int) self.X, (int) self.Y); - } +#pragma warning disable 1591 - /// - /// - /// - /// - /// - public static implicit operator Point2d(Point point) - { - return new Point2d(point.X, point.Y); - } + // ReSharper disable once InconsistentNaming + public readonly Point ToPoint() => new((int)X, (int)Y); - /// - /// - /// - /// - /// - public static implicit operator Vec2d(Point2d point) - { - return new Vec2d(point.X, point.Y); - } + public static explicit operator Point(Point2d self) => new((int) self.X, (int) self.Y); - /// - /// - /// - /// - /// - public static implicit operator Point2d(Vec2d vec) - { - return new Point2d(vec.Item0, vec.Item1); - } + public static Point2d FromPoint(Point point) => new(point.X, point.Y); + + public static implicit operator Point2d(Point point) => new(point.X, point.Y); + + // ReSharper disable once InconsistentNaming + public readonly Vec2d ToVec2d() => new(X, Y); + + public static implicit operator Vec2d(Point2d point) => new(point.X, point.Y); + + // ReSharper disable once InconsistentNaming + public static Point2d FromVec2d(Vec2d vec) => new(vec.Item0, vec.Item1); + + public static implicit operator Point2d(Vec2d vec) => new(vec.Item0, vec.Item1); + +#pragma warning restore 1591 #endregion @@ -125,101 +108,76 @@ public static implicit operator Point2d(Vec2d vec) #region + / - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else + /// + /// Unary plus operator + /// + /// + public readonly Point2d Plus() => this; + /// /// Unary plus operator /// /// /// -#endif - public static Point2d operator +(Point2d pt) - { - return pt; - } + public static Point2d operator +(Point2d pt) => pt; + + /// + /// Unary minus operator + /// + /// + public readonly Point2d Negate() => new(-X, -Y); -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else /// /// Unary minus operator /// /// /// -#endif - public static Point2d operator -(Point2d pt) - { - return new Point2d(-pt.X, -pt.Y); - } + public static Point2d operator -(Point2d pt) => pt.Negate(); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2d Add(Point2d p) => new(X + p.X, Y + p.Y); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point2d operator +(Point2d p1, Point2d p2) - { - return new Point2d(p1.X + p2.X, p1.Y + p2.Y); - } + public static Point2d operator +(Point2d p1, Point2d p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2d Subtract(Point2d p) => new(X - p.X, Y - p.Y); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point2d operator -(Point2d p1, Point2d p2) - { - return new Point2d(p1.X - p2.X, p1.Y - p2.Y); - } + public static Point2d operator -(Point2d p1, Point2d p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2d Multiply(double scale) => new(X * scale, Y * scale); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point2d operator *(Point2d pt, double scale) - { - return new Point2d((float) (pt.X*scale), (float) (pt.Y*scale)); - } + public static Point2d operator *(Point2d pt, double scale) => pt.Multiply(scale); #endregion diff --git a/src/OpenCvSharp/Modules/core/Struct/Point2f.cs b/src/OpenCvSharp/Modules/core/Struct/Point2f.cs index df68abbaf..33757699f 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point2f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point2f.cs @@ -36,45 +36,28 @@ public Point2f(float x, float y) #region Cast - /// - /// - /// - /// - /// - public static explicit operator Point(Point2f self) - { - return new Point((int) self.X, (int) self.Y); - } +#pragma warning disable 1591 - /// - /// - /// - /// - /// - public static implicit operator Point2f(Point point) - { - return new Point2f(point.X, point.Y); - } + // ReSharper disable once InconsistentNaming + public readonly Point ToPoint() => new((int)X, (int)Y); - /// - /// - /// - /// - /// - public static implicit operator Vec2f(Point2f point) - { - return new Vec2f(point.X, point.Y); - } + public static explicit operator Point(Point2f self) => self.ToPoint(); + + public static Point2f FromPoint(Point point) => new (point.X, point.Y); - /// - /// - /// - /// - /// - public static implicit operator Point2f(Vec2f vec) - { - return new Point2f(vec.Item0, vec.Item1); - } + public static implicit operator Point2f(Point point) => FromPoint(point); + + // ReSharper disable once InconsistentNaming + public readonly Vec2f ToVec2f() => new(X, Y); + + public static implicit operator Vec2f(Point2f point) => point.ToVec2f(); + + // ReSharper disable once InconsistentNaming + public static Point2f FromVec2f(Vec2f vec) => new(vec.Item0, vec.Item1); + + public static implicit operator Point2f(Vec2f vec) => FromVec2f(vec); + +#pragma warning restore 1591 #endregion @@ -126,101 +109,79 @@ public static implicit operator Point2f(Vec2f vec) #region + / - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else + /// + /// Unary plus operator + /// + /// + public readonly Point2f Plus() => this; + /// /// Unary plus operator /// /// /// -#endif public static Point2f operator +(Point2f pt) { return pt; } + + /// + /// Unary minus operator + /// + /// + public readonly Point2f Negate() => new(-X, -Y); -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else /// /// Unary minus operator /// /// /// -#endif - public static Point2f operator -(Point2f pt) - { - return new Point2f(-pt.X, -pt.Y); - } + public static Point2f operator -(Point2f pt) => pt.Negate(); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2f Add(Point2f p) => new(X + p.X, Y + p.Y); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point2f operator +(Point2f p1, Point2f p2) - { - return new Point2f(p1.X + p2.X, p1.Y + p2.Y); - } + public static Point2f operator +(Point2f p1, Point2f p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2f Subtract(Point2f p) => new(X - p.X, Y - p.Y); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point2f operator -(Point2f p1, Point2f p2) - { - return new Point2f(p1.X - p2.X, p1.Y - p2.Y); - } + public static Point2f operator -(Point2f p1, Point2f p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point2f Multiply(double scale) => new((float)(X * scale), (float)(Y * scale)); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point2f operator *(Point2f pt, double scale) - { - return new Point2f((float) (pt.X*scale), (float) (pt.Y*scale)); - } + public static Point2f operator *(Point2f pt, double scale) => pt.Multiply(scale); #endregion diff --git a/src/OpenCvSharp/Modules/core/Struct/Point3d.cs b/src/OpenCvSharp/Modules/core/Struct/Point3d.cs index 19558b280..086914fc2 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point3d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point3d.cs @@ -42,45 +42,29 @@ public Point3d(double x, double y, double z) #region Cast - /// - /// - /// - /// - /// - public static explicit operator Point3i(Point3d self) - { - return new Point3i((int)self.X, (int)self.Y, (int)self.Z); - } +#pragma warning disable 1591 - /// - /// - /// - /// - /// - public static implicit operator Point3d(Point3i point) - { - return new Point3d(point.X, point.Y, point.Z); - } + public static explicit operator Point3i(Point3d self) => self.ToPoint3i(); - /// - /// - /// - /// - /// - public static implicit operator Vec3d(Point3d point) - { - return new Vec3d(point.X, point.Y, point.Z); - } + // ReSharper disable once InconsistentNaming + public readonly Point3i ToPoint3i() => new((int)X, (int)Y, (int)Z); - /// - /// - /// - /// - /// - public static implicit operator Point3d(Vec3d vec) - { - return new Point3d(vec.Item0, vec.Item1, vec.Item2); - } + public static implicit operator Point3d(Point3i point) => FromPoint3i(point); + + // ReSharper disable once InconsistentNaming + public static Point3d FromPoint3i(Point3i point) => new(point.X, point.Y, point.Z); + + public static implicit operator Vec3d(Point3d self) => self.ToVec3d(); + + // ReSharper disable once InconsistentNaming + public readonly Vec3d ToVec3d() => new(X, Y, Z); + + public static implicit operator Point3d(Vec3d vec) => FromVec3d(vec); + + // ReSharper disable once InconsistentNaming + public static Point3d FromVec3d(Vec3d vec) => new(vec.Item0, vec.Item1, vec.Item2); + +#pragma warning restore 1591 #endregion @@ -145,10 +129,13 @@ public static implicit operator Point3d(Vec3d vec) /// /// #endif - public static Point3d operator +(Point3d pt) - { - return pt; - } + public static Point3d operator +(Point3d pt) => pt; + + /// + /// Unary plus operator + /// + /// + public readonly Point3d Plus() => this; #if LANG_JP /// @@ -163,10 +150,13 @@ public static implicit operator Point3d(Vec3d vec) /// /// #endif - public static Point3d operator -(Point3d pt) - { - return new Point3d(-pt.X, -pt.Y, -pt.Z); - } + public static Point3d operator -(Point3d pt) => pt.Negate(); + + /// + /// Unary minus operator + /// + /// + public readonly Point3d Negate() => new(-X, -Y, -Z); #if LANG_JP /// @@ -183,10 +173,14 @@ public static implicit operator Point3d(Vec3d vec) /// /// #endif - public static Point3d operator +(Point3d p1, Point3d p2) - { - return new Point3d(p1.X + p2.X, p1.Y + p2.Y, p1.Z + p2.Z); - } + public static Point3d operator +(Point3d p1, Point3d p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3d Add(Point3d p) => new(X + p.X, Y + p.Y, Z + p.Z); #if LANG_JP /// @@ -203,10 +197,14 @@ public static implicit operator Point3d(Vec3d vec) /// /// #endif - public static Point3d operator -(Point3d p1, Point3d p2) - { - return new Point3d(p1.X - p2.X, p1.Y - p2.Y, p1.Z - p2.Z); - } + public static Point3d operator -(Point3d p1, Point3d p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3d Subtract(Point3d p) => new(X - p.X, Y - p.Y, Z - p.Z); #if LANG_JP /// @@ -223,17 +221,21 @@ public static implicit operator Point3d(Vec3d vec) /// /// #endif - public static Point3d operator *(Point3d pt, double scale) - { - return new Point3d(pt.X*scale, pt.Y*scale, pt.Z*scale); - } + public static Point3d operator *(Point3d pt, double scale) => pt.Multiply(scale); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3d Multiply(double scale) => new(X * scale, Y * scale, Z * scale); #endregion #endregion #region Override - + /// public readonly bool Equals(Point3d other) { diff --git a/src/OpenCvSharp/Modules/core/Struct/Point3f.cs b/src/OpenCvSharp/Modules/core/Struct/Point3f.cs index fb435fd33..9c7c39975 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point3f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point3f.cs @@ -1,8 +1,6 @@ using System; using System.Runtime.InteropServices; -#pragma warning disable CA1051 - namespace OpenCvSharp { /// @@ -29,7 +27,7 @@ public struct Point3f : IEquatable public float Z; /// - /// + /// Constructor /// /// /// @@ -43,52 +41,36 @@ public Point3f(float x, float y, float z) #region Cast - /// - /// - /// - /// - /// - public static explicit operator Point3i(Point3f self) - { - return new Point3i((int)self.X, (int)self.Y, (int)self.Z); - } +#pragma warning disable 1591 - /// - /// - /// - /// - /// - public static implicit operator Point3f(Point3i point) - { - return new Point3f(point.X, point.Y, point.Z); - } - - /// - /// - /// - /// - /// - public static implicit operator Vec3f(Point3f point) - { - return new Vec3f(point.X, point.Y, point.Z); - } + public static explicit operator Point3i(Point3f self) => self.ToPoint3i(); - /// - /// - /// - /// - /// - public static implicit operator Point3f(Vec3f vec) - { - return new Point3f(vec.Item0, vec.Item1, vec.Item2); - } + // ReSharper disable once InconsistentNaming + public readonly Point3i ToPoint3i() => new ((int)X, (int)Y, (int)Z); + + public static implicit operator Point3f(Point3i point) => FromPoint3i(point); + + // ReSharper disable once InconsistentNaming + public static Point3f FromPoint3i(Point3i point) => new (point.X, point.Y, point.Z); + + public static implicit operator Vec3f(Point3f self) => self.ToVec3f(); + + // ReSharper disable once InconsistentNaming + public readonly Vec3f ToVec3f() => new(X, Y, Z); + + public static implicit operator Point3f(Vec3f vec) => FromVec3f(vec); + + // ReSharper disable once InconsistentNaming + public static Point3f FromVec3f(Vec3f vec) => new (vec.Item0, vec.Item1, vec.Item2); + +#pragma warning restore 1591 #endregion #region Operators #region == / != - + #if LANG_JP /// /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す @@ -132,102 +114,78 @@ public static implicit operator Point3f(Vec3f vec) #endregion #region + / - + + /// + /// Unary plus operator + /// + /// + public readonly Point3f Plus() => this; -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else /// /// Unary plus operator /// /// /// -#endif - public static Point3f operator +(Point3f pt) - { - return pt; - } + public static Point3f operator +(Point3f pt) => pt; + + /// + /// Unary minus operator + /// + /// + public readonly Point3f Negate() => new(-X, -Y, -Z); -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else /// /// Unary minus operator /// /// /// -#endif - public static Point3f operator -(Point3f pt) - { - return new Point3f(-pt.X, -pt.Y, -pt.Z); - } + public static Point3f operator -(Point3f pt) => pt.Negate(); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3f Add(Point3f p) => new(X + p.X, Y + p.Y, Z + p.Z); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point3f operator +(Point3f p1, Point3f p2) - { - return new Point3f(p1.X + p2.X, p1.Y + p2.Y, p1.Z + p2.Z); - } + public static Point3f operator +(Point3f p1, Point3f p2) => p1.Add(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3f Subtract(Point3f p) => new(X - p.X, Y - p.Y, Z - p.Z); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point3f operator -(Point3f p1, Point3f p2) - { - return new Point3f(p1.X - p2.X, p1.Y - p2.Y, p1.Z - p2.Z); - } + public static Point3f operator -(Point3f p1, Point3f p2) => p1.Subtract(p2); + + /// + /// Shifts point by a certain offset + /// + /// + /// + public readonly Point3f Multiply(double scale) + => new((float)(X * scale), (float)(Y * scale), (float)(Z * scale)); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif - public static Point3f operator *(Point3f pt, double scale) - { - return new Point3f((float) (pt.X*scale), (float) (pt.Y*scale), (float) (pt.Z*scale)); - } + public static Point3f operator *(Point3f pt, double scale) => pt.Multiply(scale); #endregion diff --git a/src/OpenCvSharp/Modules/core/Struct/Rangef.cs b/src/OpenCvSharp/Modules/core/Struct/Rangef.cs index 9af5d230c..39814b0d3 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Rangef.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Rangef.cs @@ -1,8 +1,6 @@ using System; using System.Runtime.InteropServices; -#pragma warning disable CA1051 - namespace OpenCvSharp { /// @@ -10,7 +8,8 @@ namespace OpenCvSharp /// [Serializable] [StructLayout(LayoutKind.Sequential)] - public readonly struct Rangef + // ReSharper disable once IdentifierTypo + public readonly struct Rangef : IEquatable { /// /// @@ -27,25 +26,65 @@ public readonly struct Rangef /// /// /// + // ReSharper disable once IdentifierTypo public Rangef(float start, float end) { Start = start; End = end; } + /// + /// Convert to Range + /// + /// + public Range ToRange() => new ((int)Start, (int)End); + /// /// Implicit operator (Range)this /// /// /// - public static implicit operator Range(Rangef range) - { - return new Range((int)range.Start, (int)range.End); - } + public static implicit operator Range(Rangef range) => new ((int)range.Start, (int)range.End); /// /// Range(int.MinValue, int.MaxValue) /// - public static Range All => new Range(int.MinValue, int.MaxValue); + public static Range All => new (int.MinValue, int.MaxValue); + +#pragma warning disable CS1591 + public bool Equals(Rangef other) + { + return Start.Equals(other.Start) && End.Equals(other.End); + } + + public override bool Equals(object? obj) + { + return obj is Rangef other && Equals(other); + } + + public override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Start.GetHashCode(); + hashCode = (hashCode * 397) ^ End.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Start, End); +#endif + } + + public static bool operator ==(Rangef left, Rangef right) + { + return left.Equals(right); + } + + public static bool operator !=(Rangef left, Rangef right) + { + return !left.Equals(right); + } +#pragma warning restore CS1591 } } diff --git a/src/OpenCvSharp/Modules/core/Struct/Rect.cs b/src/OpenCvSharp/Modules/core/Struct/Rect.cs index 83b9eee0c..25b03b48e 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Rect.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Rect.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; #pragma warning disable CA1051 @@ -163,10 +164,14 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) /// /// #endif - public static Rect operator +(Rect rect, Point pt) - { - return new Rect(rect.X + pt.X, rect.Y + pt.Y, rect.Width, rect.Height); - } + public static Rect operator +(Rect rect, Point pt) => rect.Add(pt); + + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect Add(Point pt) => new (X + pt.X, Y + pt.Y, Width, Height); #if LANG_JP /// @@ -185,9 +190,16 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) #endif public static Rect operator -(Rect rect, Point pt) { - return new Rect(rect.X - pt.X, rect.Y - pt.Y, rect.Width, rect.Height); + return new (rect.X - pt.X, rect.Y - pt.Y, rect.Width, rect.Height); } + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect Subtract(Point pt) => new(X - pt.X, Y - pt.Y, Width, Height); + #if LANG_JP /// /// 指定したサイズ応じて、矩形を膨張または縮小する @@ -205,9 +217,16 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) #endif public static Rect operator +(Rect rect, Size size) { - return new Rect(rect.X, rect.Y, rect.Width + size.Width, rect.Height + size.Height); + return new (rect.X, rect.Y, rect.Width + size.Width, rect.Height + size.Height); } + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + public readonly Rect Add(Size size) => new (X, Y, Width + size.Width, Height + size.Height); + #if LANG_JP /// /// 指定したサイズ応じて、矩形を膨張または縮小する @@ -228,6 +247,13 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) return new Rect(rect.X, rect.Y, rect.Width - size.Width, rect.Height - size.Height); } + /// + /// Expands or shrinks rectangle by a certain amount + /// + /// + /// + public readonly Rect Subtract(Size size) => new(X, Y, Width - size.Width, Height - size.Height); + #endregion #region & / | @@ -247,6 +273,7 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) /// A rectangle to intersect. /// #endif + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect operator &(Rect a, Rect b) { return Intersect(a, b); @@ -267,6 +294,7 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) /// A rectangle to union. /// #endif + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect operator |(Rect a, Rect b) { return Union(a, b); diff --git a/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs b/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs index 7075957fc..33f2c44d7 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; #pragma warning disable CA1051 @@ -213,9 +214,16 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott #endif public static Rect2d operator +(Rect2d rect, Size2d size) { - return new Rect2d(rect.X, rect.Y, rect.Width + size.Width, rect.Height + size.Height); + return new (rect.X, rect.Y, rect.Width + size.Width, rect.Height + size.Height); } + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect2d Add(Size2d size) => new(X, Y, Width + size.Width, Height + size.Height); + #if LANG_JP /// /// 指定したサイズ応じて、矩形を膨張または縮小する @@ -233,9 +241,16 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott #endif public static Rect2d operator -(Rect2d rect, Size2d size) { - return new Rect2d(rect.X, rect.Y, rect.Width - size.Width, rect.Height - size.Height); + return new (rect.X, rect.Y, rect.Width - size.Width, rect.Height - size.Height); } + /// + /// Shifts rectangle by a certain offset + /// + /// + /// + public readonly Rect2d Subtract(Size2d size) => new(X, Y, Width - size.Width, Height - size.Height); + #endregion #region & / | @@ -255,6 +270,7 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott /// A rectangle to intersect. /// #endif + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect2d operator &(Rect2d a, Rect2d b) { return Intersect(a, b); @@ -275,6 +291,7 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott /// A rectangle to union. /// #endif + [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect2d operator |(Rect2d a, Rect2d b) { return Union(a, b); diff --git a/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs b/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs index 4e92a7d5b..0c8f8180a 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs @@ -163,10 +163,7 @@ public static Rect2f FromLTRB(float left, float top, float right, float bottom) /// /// #endif - public Rect2f Add(Point2f pt) - { - return new Rect2f(X + pt.X, Y + pt.Y, Width, Height); - } + public readonly Rect2f Add(Point2f pt) => new (X + pt.X, Y + pt.Y, Width, Height); /// /// Shifts rectangle by a certain offset @@ -174,10 +171,7 @@ public Rect2f Add(Point2f pt) /// /// /// - public static Rect2f operator +(Rect2f rect, Point2f pt) - { - return rect.Add(pt); - } + public static Rect2f operator +(Rect2f rect, Point2f pt) => rect.Add(pt); #if LANG_JP /// @@ -193,10 +187,7 @@ public Rect2f Add(Point2f pt) /// /// #endif - public Rect2f Subtract(Point2f pt) - { - return new Rect2f(X - pt.X, Y - pt.Y, Width, Height); - } + public readonly Rect2f Subtract(Point2f pt) => new (X - pt.X, Y - pt.Y, Width, Height); /// /// Shifts rectangle by a certain offset @@ -204,10 +195,7 @@ public Rect2f Subtract(Point2f pt) /// /// /// - public static Rect2f operator -(Rect2f rect, Point2f pt) - { - return rect.Subtract(pt); - } + public static Rect2f operator -(Rect2f rect, Point2f pt) => rect.Subtract(pt); #if LANG_JP /// @@ -222,10 +210,7 @@ public Rect2f Subtract(Point2f pt) /// /// #endif - public Rect2f Add(Size2f size) - { - return new Rect2f(X, Y, Width + size.Width, Height + size.Height); - } + public readonly Rect2f Add(Size2f size) => new (X, Y, Width + size.Width, Height + size.Height); /// /// Expands or shrinks rectangle by a certain amount @@ -233,10 +218,7 @@ public Rect2f Add(Size2f size) /// /// /// - public static Rect2f operator +(Rect2f rect, Size2f size) - { - return rect.Add(size); - } + public static Rect2f operator +(Rect2f rect, Size2f size) => rect.Add(size); #if LANG_JP /// @@ -251,10 +233,7 @@ public Rect2f Add(Size2f size) /// /// #endif - public Rect2f Subtract(Size2f size) - { - return new Rect2f(X, Y, Width - size.Width, Height - size.Height); - } + public readonly Rect2f Subtract(Size2f size) => new (X, Y, Width - size.Width, Height - size.Height); /// /// Expands or shrinks rectangle by a certain amount @@ -262,10 +241,7 @@ public Rect2f Subtract(Size2f size) /// /// /// - public static Rect2f operator -(Rect2f rect, Size2f size) - { - return rect.Subtract(size); - } + public static Rect2f operator -(Rect2f rect, Size2f size) => rect.Subtract(size); #endregion diff --git a/src/OpenCvSharp/Modules/core/Struct/RotatedRect.cs b/src/OpenCvSharp/Modules/core/Struct/RotatedRect.cs index e260cbecc..ddfdfea97 100644 --- a/src/OpenCvSharp/Modules/core/Struct/RotatedRect.cs +++ b/src/OpenCvSharp/Modules/core/Struct/RotatedRect.cs @@ -7,7 +7,7 @@ namespace OpenCvSharp /// The class represents rotated (i.e. not up-right) rectangles on a plane. /// [StructLayout(LayoutKind.Sequential)] - public struct RotatedRect + public struct RotatedRect : IEquatable { /// /// the rectangle mass center @@ -77,5 +77,44 @@ public readonly Rect BoundingRect() r.Height -= r.Y - 1; return r; } + +#pragma warning disable CS1591 + + public bool Equals(RotatedRect other) + { + return Center.Equals(other.Center) && Size.Equals(other.Size) && Angle.Equals(other.Angle); + } + + public override bool Equals(object? obj) + { + return obj is RotatedRect other && Equals(other); + } + + public override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Center.GetHashCode(); + hashCode = (hashCode * 397) ^ Size.GetHashCode(); + hashCode = (hashCode * 397) ^ Angle.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine(Center, Size, Angle); +#endif + } + + public static bool operator ==(RotatedRect left, RotatedRect right) + { + return left.Equals(right); + } + + public static bool operator !=(RotatedRect left, RotatedRect right) + { + return !left.Equals(right); + } + +#pragma warning restore CS1591 } } diff --git a/src/OpenCvSharp/Modules/core/Struct/Scalar.cs b/src/OpenCvSharp/Modules/core/Struct/Scalar.cs index 5bf53994d..36a773fc0 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Scalar.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Scalar.cs @@ -134,7 +134,7 @@ public Scalar(double v0, double v1, double v2, double v3) /// public static Scalar FromRgb(int r, int g, int b) { - return new Scalar(b, g, r); + return new(b, g, r); } /// @@ -156,196 +156,62 @@ public static Scalar RandomColor(Random random) return new Scalar(buf[0], buf[1], buf[2]); } - private static readonly Random defaultRandom = new Random(); + private static readonly Random defaultRandom = new(); #endregion #region Cast - /// - /// - /// - /// - /// - public static explicit operator double(Scalar self) - { - return self.Val0; - } - - /// - /// - /// - /// - /// - public static implicit operator Scalar(double val) - { - return new Scalar(val); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(DMatch d) - { - return new Scalar(d.QueryIdx, d.TrainIdx, d.ImgIdx, d.Distance); - } - - /// - /// - /// - /// - /// - public static explicit operator DMatch(Scalar self) - { - return new DMatch((int) self.Val0, (int) self.Val1, (int) self.Val2, (float) self.Val3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec3b v) - { - return new Scalar(v.Item0, v.Item1, v.Item2); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec3f v) - { - return new Scalar(v.Item0, v.Item1, v.Item2); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec4f v) - { - return new Scalar(v.Item0, v.Item1, v.Item2, v.Item3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec6f v) - { - return new Scalar(v.Item0, v.Item1, v.Item2, v.Item3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec3d v) - { - return new Scalar(v.Item0, v.Item1, v.Item2); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec4d v) - { - return new Scalar(v.Item0, v.Item1, v.Item2, v.Item3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Vec6d v) - { - return new Scalar(v.Item0, v.Item1, v.Item2, v.Item3); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point p) - { - return new Scalar(p.X, p.Y); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point2f p) - { - return new Scalar(p.X, p.Y); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point2d p) - { - return new Scalar(p.X, p.Y); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point3i p) - { - return new Scalar(p.X, p.Y, p.Z); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point3f p) - { - return new Scalar(p.X, p.Y, p.Z); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Point3d p) - { - return new Scalar(p.X, p.Y, p.Z); - } - - /// - /// - /// - /// - /// - public static explicit operator Scalar(Rect p) - { - return new Scalar(p.X, p.Y, p.Width, p.Height); - } +#pragma warning disable 1591 + + public readonly double ToDouble() => Val0; + public readonly DMatch ToDMatch() => new((int)Val0, (int)Val1, (int)Val2, (float)Val3); + + public static explicit operator double(Scalar self) => self.ToDouble(); + public static explicit operator DMatch(Scalar self) => new((int)self.Val0, (int)self.Val1, (int)self.Val2, (float)self.Val3); + + // ReSharper disable InconsistentNaming + public static Scalar FromDouble(double val) => new(val); + public static Scalar FromDMatch(DMatch d) => new(d.QueryIdx, d.TrainIdx, d.ImgIdx, d.Distance); + public static Scalar FromVec3b(Vec3b v) => new(v.Item0, v.Item1, v.Item2); + public static Scalar FromVec3f(Vec3f v) => new(v.Item0, v.Item1, v.Item2); + public static Scalar FromVec4f(Vec4f v) => new(v.Item0, v.Item1, v.Item2, v.Item3); + public static Scalar FromVec6f(Vec6f v) => new(v.Item0, v.Item1, v.Item2, v.Item3); + public static Scalar FromVec3d(Vec3d v) => new(v.Item0, v.Item1, v.Item2); + public static Scalar FromVec4d(Vec4d v) => new(v.Item0, v.Item1, v.Item2, v.Item3); + public static Scalar FromVec6d(Vec6d v) => new(v.Item0, v.Item1, v.Item2, v.Item3); + public static Scalar FromPoint(Point p) => new(p.X, p.Y); + public static Scalar FromPoint2f(Point2f p) => new(p.X, p.Y); + public static Scalar FromPoint2d(Point2d p) => new(p.X, p.Y); + public static Scalar FromPoint3i(Point3i p) => new(p.X, p.Y, p.Z); + public static Scalar FromPoint3f(Point3f p) => new(p.X, p.Y, p.Z); + public static Scalar FromPoint3d(Point3d p) => new(p.X, p.Y, p.Z); + public static Scalar FromRect(Rect p) => new(p.X, p.Y, p.Width, p.Height); + // ReSharper restore InconsistentNaming + + public static implicit operator Scalar(double val) => FromDouble(val); + public static explicit operator Scalar(DMatch d) => FromDMatch(d); + public static explicit operator Scalar(Vec3b v) => FromVec3b(v); + public static explicit operator Scalar(Vec3f v) => FromVec3f(v); + public static explicit operator Scalar(Vec4f v) => FromVec4f(v); + public static explicit operator Scalar(Vec6f v) => FromVec6f(v); + public static explicit operator Scalar(Vec3d v) => FromVec3d(v); + public static explicit operator Scalar(Vec4d v) => FromVec4d(v); + public static explicit operator Scalar(Vec6d v) => FromVec6d(v); + public static explicit operator Scalar(Point p) => FromPoint(p); + public static explicit operator Scalar(Point2f p) => FromPoint2f(p); + public static explicit operator Scalar(Point2d p) => FromPoint2d(p); + public static explicit operator Scalar(Point3i p) => FromPoint3i(p); + public static explicit operator Scalar(Point3f p) => FromPoint3f(p); + public static explicit operator Scalar(Point3d p) => FromPoint3d(p); + public static explicit operator Scalar(Rect p) => FromRect(p); + +#pragma warning restore 1591 #endregion #region Override - + /// public readonly bool Equals(Scalar other) { @@ -414,7 +280,7 @@ public override readonly string ToString() /// public static Scalar All(double v) { - return new Scalar(v, v, v, v); + return new(v, v, v, v); } /// @@ -425,7 +291,7 @@ public static Scalar All(double v) /// public readonly Scalar Mul(Scalar it, double scale) { - return new Scalar(Val0*it.Val0*scale, Val1*it.Val1*scale, + return new(Val0*it.Val0*scale, Val1*it.Val1*scale, Val2*it.Val2*scale, Val3*it.Val3*scale); } @@ -445,7 +311,7 @@ public readonly Scalar Mul(Scalar it) /// public readonly Scalar Conj() { - return new Scalar(Val0, -Val1, -Val2, -Val3); + return new(Val0, -Val1, -Val2, -Val3); } /// @@ -465,7 +331,7 @@ public readonly bool IsReal() // ReSharper disable once InconsistentNaming public readonly Vec3b ToVec3b() { - return new Vec3b((byte)Val0, (byte)Val1, (byte)Val2); + return new((byte)Val0, (byte)Val1, (byte)Val2); } #endregion @@ -1171,7 +1037,7 @@ public readonly Vec3b ToVec3b() /// #9ACD32 /// public static readonly Scalar YellowGreen = FromRgb(154, 205, 50); - + #endregion } } diff --git a/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs b/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs index 9cd31c789..13049365e 100644 --- a/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs +++ b/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs @@ -1,11 +1,13 @@ -#pragma warning disable CA1051 +using System; + +#pragma warning disable CA1051 namespace OpenCvSharp { /// /// The class defining termination criteria for iterative algorithms. /// - public readonly struct TermCriteria + public readonly struct TermCriteria : IEquatable { /// /// the type of termination criteria: COUNT, EPS or COUNT + EPS @@ -42,10 +44,49 @@ public TermCriteria(CriteriaType type, int maxCount, double epsilon) /// public static TermCriteria Both(int maxCount, double epsilon) { - return new TermCriteria( + return new ( type: CriteriaType.Count | CriteriaType.Eps, maxCount: maxCount, epsilon: epsilon); } + +#pragma warning disable CS1591 + + public bool Equals(TermCriteria other) + { + return Type == other.Type && MaxCount == other.MaxCount && Epsilon.Equals(other.Epsilon); + } + + public override bool Equals(object? obj) + { + return obj is TermCriteria other && Equals(other); + } + + public override int GetHashCode() + { +#if DOTNET_FRAMEWORK || NETSTANDARD2_0 + unchecked + { + var hashCode = Type.GetHashCode(); + hashCode = (hashCode * 397) ^ MaxCount.GetHashCode(); + hashCode = (hashCode * 397) ^ Epsilon.GetHashCode(); + return hashCode; + } +#else + return HashCode.Combine((int) Type, MaxCount, Epsilon); +#endif + } + + public static bool operator ==(TermCriteria left, TermCriteria right) + { + return left.Equals(right); + } + + public static bool operator !=(TermCriteria left, TermCriteria right) + { + return !left.Equals(right); + } + +#pragma warning restore CS1591 } } diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2b.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2b.cs index b4a7f1319..3b02fb7e4 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2b.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2b.cs @@ -86,7 +86,6 @@ public Vec2b(byte item0, byte item1) SaturateCast.ToByte(Item1 / alpha)); #pragma warning disable 1591 - public static Vec2b operator +(Vec2b self) => self; public static Vec2b operator +(Vec2b a, Vec2b b) => a.Add(b); public static Vec2b operator -(Vec2b a, Vec2b b) => a.Subtract(b); public static Vec2b operator *(Vec2b a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2d.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2d.cs index b05498b8e..6fdc5f258 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2d.cs @@ -79,8 +79,6 @@ public Vec2d(double item0, double item1) Item1 / alpha); #pragma warning disable 1591 - public static Vec2d operator +(Vec2d self) => self; - public static Vec2d operator -(Vec2d self) => new(-self.Item0, -self.Item1); public static Vec2d operator +(Vec2d a, Vec2d b) => a.Add(b); public static Vec2d operator -(Vec2d a, Vec2d b) => a.Subtract(b); public static Vec2d operator *(Vec2d a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2f.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2f.cs index 55d1c704e..c8e7ebdfe 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2f.cs @@ -78,8 +78,6 @@ public Vec2f(float item0, float item1) (float)(Item1 / alpha)); #pragma warning disable 1591 - public static Vec2f operator +(Vec2f self) => self; - public static Vec2f operator -(Vec2f self) => new(-self.Item0, -self.Item1); public static Vec2f operator +(Vec2f a, Vec2f b) => a.Add(b); public static Vec2f operator -(Vec2f a, Vec2f b) => a.Subtract(b); public static Vec2f operator *(Vec2f a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2i.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2i.cs index a35111553..4e5112f63 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2i.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2i.cs @@ -79,8 +79,6 @@ public Vec2i(int item0, int item1) SaturateCast.ToInt32(Item1 / alpha)); #pragma warning disable 1591 - public static Vec2i operator +(Vec2i self) => self; - public static Vec2i operator -(Vec2i self) => new(-self.Item0, -self.Item1); public static Vec2i operator +(Vec2i a, Vec2i b) => a.Add(b); public static Vec2i operator -(Vec2i a, Vec2i b) => a.Subtract(b); public static Vec2i operator *(Vec2i a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2s.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2s.cs index 0e48abb39..c6502807b 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2s.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2s.cs @@ -81,8 +81,6 @@ public Vec2s(short item0, short item1) SaturateCast.ToInt16(Item1 / alpha)); #pragma warning disable 1591 - public static Vec2s operator +(Vec2s self) => self; - public static Vec2s operator -(Vec2s self) => self.Multiply(-1); public static Vec2s operator +(Vec2s a, Vec2s b) => a.Add(b); public static Vec2s operator -(Vec2s a, Vec2s b) => a.Subtract(b); public static Vec2s operator *(Vec2s a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2w.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2w.cs index 0c3926c72..ced11894b 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2w.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec2w.cs @@ -79,7 +79,6 @@ public Vec2w(ushort item0, ushort item1) SaturateCast.ToUInt16(Item1 / alpha)); #pragma warning disable 1591 - public static Vec2w operator +(Vec2w self) => self; public static Vec2w operator +(Vec2w a, Vec2w b) => a.Add(b); public static Vec2w operator -(Vec2w a, Vec2w b) => a.Subtract(b); public static Vec2w operator *(Vec2w a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3b.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3b.cs index f358d94fe..b6eb44f5d 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3b.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3b.cs @@ -91,7 +91,6 @@ public Vec3b(byte item0, byte item1, byte item2) SaturateCast.ToByte(Item2 / alpha)); #pragma warning disable 1591 - public static Vec3b operator +(Vec3b self) => self; public static Vec3b operator +(Vec3b a, Vec3b b) => a.Add(b); public static Vec3b operator -(Vec3b a, Vec3b b) => a.Subtract(b); public static Vec3b operator *(Vec3b a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3d.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3d.cs index 2574f60f6..4c0b9c58d 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3d.cs @@ -92,8 +92,6 @@ public Vec3d(double item0, double item1, double item2) Item2 / alpha); #pragma warning disable 1591 - public static Vec3d operator +(Vec3d self) => self; - public static Vec3d operator -(Vec3d self) => new(-self.Item0, -self.Item1, -self.Item2); public static Vec3d operator +(Vec3d a, Vec3d b) => a.Add(b); public static Vec3d operator -(Vec3d a, Vec3d b) => a.Subtract(b); public static Vec3d operator *(Vec3d a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3f.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3f.cs index e54a73653..c7b92d3a1 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3f.cs @@ -90,8 +90,6 @@ public Vec3f(float item0, float item1, float item2) (float)(Item2 / alpha)); #pragma warning disable 1591 - public static Vec3f operator +(Vec3f self) => self; - public static Vec3f operator -(Vec3f self) => new(-self.Item0, -self.Item1, -self.Item2); public static Vec3f operator +(Vec3f a, Vec3f b) => a.Add(b); public static Vec3f operator -(Vec3f a, Vec3f b) => a.Subtract(b); public static Vec3f operator *(Vec3f a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3i.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3i.cs index 2cfcd4d3c..64d169d9b 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3i.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3i.cs @@ -92,8 +92,6 @@ public Vec3i(int item0, int item1, int item2) SaturateCast.ToInt32(Item2 / alpha)); #pragma warning disable 1591 - public static Vec3i operator +(Vec3i self) => self; - public static Vec3i operator -(Vec3i self) => new(-self.Item0, -self.Item1, -self.Item2); public static Vec3i operator +(Vec3i a, Vec3i b) => a.Add(b); public static Vec3i operator -(Vec3i a, Vec3i b) => a.Subtract(b); public static Vec3i operator *(Vec3i a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3s.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3s.cs index f8cf45fc8..cc34a8f5d 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3s.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3s.cs @@ -91,8 +91,6 @@ public Vec3s(short item0, short item1, short item2) SaturateCast.ToInt16(Item2 / alpha)); #pragma warning disable 1591 - public static Vec3s operator +(Vec3s self) => self; - public static Vec3s operator -(Vec3s self) => self.Multiply(-1); public static Vec3s operator +(Vec3s a, Vec3s b) => a.Add(b); public static Vec3s operator -(Vec3s a, Vec3s b) => a.Subtract(b); public static Vec3s operator *(Vec3s a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3w.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3w.cs index 70b90296c..525632ddf 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3w.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec3w.cs @@ -92,7 +92,6 @@ public Vec3w(ushort item0, ushort item1, ushort item2) SaturateCast.ToUInt16(Item2 / alpha)); #pragma warning disable 1591 - public static Vec3w operator +(Vec3w self) => self; public static Vec3w operator +(Vec3w a, Vec3w b) => a.Add(b); public static Vec3w operator -(Vec3w a, Vec3w b) => a.Subtract(b); public static Vec3w operator *(Vec3w a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4b.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4b.cs index dc5598602..ef1d427a9 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4b.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4b.cs @@ -105,7 +105,6 @@ public Vec4b(byte item0, byte item1, byte item2, byte item3) SaturateCast.ToByte(Item3 / alpha)); #pragma warning disable 1591 - public static Vec4b operator +(Vec4b self) => self; public static Vec4b operator +(Vec4b a, Vec4b b) => a.Add(b); public static Vec4b operator -(Vec4b a, Vec4b b) => a.Subtract(b); public static Vec4b operator *(Vec4b a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4d.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4d.cs index 8fdb25a55..c7c34d052 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4d.cs @@ -102,8 +102,6 @@ public Vec4d(double item0, double item1, double item2, double item3) Item3 / alpha); #pragma warning disable 1591 - public static Vec4d operator +(Vec4d self) => self; - public static Vec4d operator -(Vec4d self) => new(-self.Item0, -self.Item1, -self.Item2, -self.Item3); public static Vec4d operator +(Vec4d a, Vec4d b) => a.Add(b); public static Vec4d operator -(Vec4d a, Vec4d b) => a.Subtract(b); public static Vec4d operator *(Vec4d a, double alpha) => a.Multiply(alpha); @@ -142,8 +140,7 @@ readonly get } #endregion - - + /// public readonly bool Equals(Vec4d other) { diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4f.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4f.cs index fec27e4c6..82004b180 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4f.cs @@ -103,8 +103,6 @@ public Vec4f(float item0, float item1, float item2, float item3) (float)(Item3 / alpha)); #pragma warning disable 1591 - public static Vec4f operator +(Vec4f self) => self; - public static Vec4f operator -(Vec4f self) => new(-self.Item0, -self.Item1, -self.Item2, -self.Item3); public static Vec4f operator +(Vec4f a, Vec4f b) => a.Add(b); public static Vec4f operator -(Vec4f a, Vec4f b) => a.Subtract(b); public static Vec4f operator *(Vec4f a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4i.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4i.cs index 07d07f9b7..eae924b78 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4i.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4i.cs @@ -104,8 +104,6 @@ public Vec4i(int item0, int item1, int item2, int item3) SaturateCast.ToInt32(Item3 / alpha)); #pragma warning disable 1591 - public static Vec4i operator +(Vec4i self) => self; - public static Vec4i operator -(Vec4i self) => new(-self.Item0, -self.Item1, -self.Item2, -self.Item3); public static Vec4i operator +(Vec4i a, Vec4i b) => a.Add(b); public static Vec4i operator -(Vec4i a, Vec4i b) => a.Subtract(b); public static Vec4i operator *(Vec4i a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4s.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4s.cs index 75be79efc..772575b2c 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4s.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4s.cs @@ -58,7 +58,7 @@ public Vec4s(short item0, short item1, short item2, short item3) } #region Operators - + /// /// this + other /// @@ -104,8 +104,6 @@ public Vec4s(short item0, short item1, short item2, short item3) SaturateCast.ToInt16(Item3 / alpha)); #pragma warning disable 1591 - public static Vec4s operator +(Vec4s self) => self; - public static Vec4s operator -(Vec4s self) => self.Multiply(-1); public static Vec4s operator +(Vec4s a, Vec4s b) => a.Add(b); public static Vec4s operator -(Vec4s a, Vec4s b) => a.Subtract(b); public static Vec4s operator *(Vec4s a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4w.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4w.cs index 19eb66e08..5eef86dbe 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4w.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec4w.cs @@ -104,7 +104,6 @@ public Vec4w(ushort item0, ushort item1, ushort item2, ushort item3) SaturateCast.ToUInt16(Item3 / alpha)); #pragma warning disable 1591 - public static Vec4w operator +(Vec4w self) => self; public static Vec4w operator +(Vec4w a, Vec4w b) => a.Add(b); public static Vec4w operator -(Vec4w a, Vec4w b) => a.Subtract(b); public static Vec4w operator *(Vec4w a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6b.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6b.cs index 6482eb90f..4fc534297 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6b.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6b.cs @@ -127,7 +127,6 @@ public Vec6b(byte item0, byte item1, byte item2, byte item3, byte item4, byte it SaturateCast.ToByte(Item5 / alpha)); #pragma warning disable 1591 - public static Vec6b operator +(Vec6b self) => self; public static Vec6b operator +(Vec6b a, Vec6b b) => a.Add(b); public static Vec6b operator -(Vec6b a, Vec6b b) => a.Subtract(b); public static Vec6b operator *(Vec6b a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6d.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6d.cs index 22934b3a8..91d296c4e 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6d.cs @@ -126,8 +126,6 @@ public Vec6d(double item0, double item1, double item2, double item3, double item Item5 / alpha); #pragma warning disable 1591 - public static Vec6d operator +(Vec6d self) => self; - public static Vec6d operator -(Vec6d self) => new(-self.Item0, -self.Item1, -self.Item2, -self.Item3, -self.Item4, -self.Item5); public static Vec6d operator +(Vec6d a, Vec6d b) => a.Add(b); public static Vec6d operator -(Vec6d a, Vec6d b) => a.Subtract(b); public static Vec6d operator *(Vec6d a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6f.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6f.cs index 7ba31cc81..ac8c85e81 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6f.cs @@ -127,8 +127,6 @@ public Vec6f(float item0, float item1, float item2, float item3, float item4, fl (float)(Item5 / alpha)); #pragma warning disable 1591 - public static Vec6f operator +(Vec6f self) => self; - public static Vec6f operator -(Vec6f self) => new(-self.Item0, -self.Item1, -self.Item2, -self.Item3, -self.Item4, -self.Item5); public static Vec6f operator +(Vec6f a, Vec6f b) => a.Add(b); public static Vec6f operator -(Vec6f a, Vec6f b) => a.Subtract(b); public static Vec6f operator *(Vec6f a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6i.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6i.cs index 9b7ecfd43..62f67362d 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6i.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6i.cs @@ -128,8 +128,6 @@ public Vec6i(int item0, int item1, int item2, int item3, int item4, int item5) SaturateCast.ToInt32(Item5 / alpha)); #pragma warning disable 1591 - public static Vec6i operator +(Vec6i self) => self; - public static Vec6i operator -(Vec6i self) => new(-self.Item0, -self.Item1, -self.Item2, -self.Item3, -self.Item4, -self.Item5); public static Vec6i operator +(Vec6i a, Vec6i b) => a.Add(b); public static Vec6i operator -(Vec6i a, Vec6i b) => a.Subtract(b); public static Vec6i operator *(Vec6i a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6s.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6s.cs index b7aec2ac6..6bfe926d7 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6s.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6s.cs @@ -128,8 +128,6 @@ public Vec6s(short item0, short item1, short item2, short item3, short item4, sh SaturateCast.ToInt16(Item5 / alpha)); #pragma warning disable 1591 - public static Vec6s operator +(Vec6s self) => self; - public static Vec6s operator -(Vec6s self) => self.Multiply(-1); public static Vec6s operator +(Vec6s a, Vec6s b) => a.Add(b); public static Vec6s operator -(Vec6s a, Vec6s b) => a.Subtract(b); public static Vec6s operator *(Vec6s a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6w.cs b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6w.cs index 37f11d272..bbe4a505f 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6w.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Vec/Vec6w.cs @@ -128,7 +128,6 @@ public Vec6w(ushort item0, ushort item1, ushort item2, ushort item3, ushort item SaturateCast.ToUInt16(Item5 / alpha)); #pragma warning disable 1591 - public static Vec6w operator +(Vec6w self) => self; public static Vec6w operator +(Vec6w a, Vec6w b) => a.Add(b); public static Vec6w operator -(Vec6w a, Vec6w b) => a.Subtract(b); public static Vec6w operator *(Vec6w a, double alpha) => a.Multiply(alpha); diff --git a/src/OpenCvSharp/Modules/features2d/BOWKMeansTrainer.cs b/src/OpenCvSharp/Modules/features2d/BOWKMeansTrainer.cs index 300a3e09b..caa50b308 100644 --- a/src/OpenCvSharp/Modules/features2d/BOWKMeansTrainer.cs +++ b/src/OpenCvSharp/Modules/features2d/BOWKMeansTrainer.cs @@ -58,8 +58,11 @@ public override Mat Cluster() /// public override Mat Cluster(Mat descriptors) { + if (descriptors == null) + throw new ArgumentNullException(nameof(descriptors)); ThrowIfDisposed(); descriptors.ThrowIfDisposed(); + NativeMethods.HandleException( NativeMethods.features2d_BOWKMeansTrainer_cluster2(ptr, descriptors.CvPtr, out var p)); GC.KeepAlive(this); diff --git a/src/OpenCvSharp/Modules/features2d/Feature2D.cs b/src/OpenCvSharp/Modules/features2d/Feature2D.cs index 11aec796c..69f5b95d5 100644 --- a/src/OpenCvSharp/Modules/features2d/Feature2D.cs +++ b/src/OpenCvSharp/Modules/features2d/Feature2D.cs @@ -184,6 +184,8 @@ public virtual void Compute(InputArray image, ref KeyPoint[] keypoints, OutputAr { if (image == null) throw new ArgumentNullException(nameof(image)); + if (descriptors == null) + throw new ArgumentNullException(nameof(descriptors)); ThrowIfDisposed(); using var keypointsVec = new VectorOfKeyPoint(keypoints); diff --git a/src/OpenCvSharp/Modules/features2d/SimpleBlobDetector.cs b/src/OpenCvSharp/Modules/features2d/SimpleBlobDetector.cs index 57b5c9283..8259be7d0 100644 --- a/src/OpenCvSharp/Modules/features2d/SimpleBlobDetector.cs +++ b/src/OpenCvSharp/Modules/features2d/SimpleBlobDetector.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using OpenCvSharp.Internal; @@ -165,6 +166,7 @@ public float MaxConvexity #pragma warning disable CA1051 [StructLayout(LayoutKind.Sequential)] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct WParams { public float thresholdStep; diff --git a/src/OpenCvSharp/Modules/flann/FlannDistance.cs b/src/OpenCvSharp/Modules/flann/FlannDistance.cs index 05037115a..ce57c7f6c 100644 --- a/src/OpenCvSharp/Modules/flann/FlannDistance.cs +++ b/src/OpenCvSharp/Modules/flann/FlannDistance.cs @@ -1,23 +1,24 @@ namespace OpenCvSharp.Flann { #pragma warning disable 1591 -// ReSharper disable InconsistentNaming - - /// - /// - /// +#pragma warning disable CA1069 + // ReSharper disable InconsistentNaming + public enum FlannDistance { Euclidean = 1, L2 = 1, Manhattan = 2, L1 = 2, + // ReSharper disable once IdentifierTypo Minkowski = 3, Max = 4, HistIntersect = 5, + // ReSharper disable once IdentifierTypo Hellinger = 6, ChiSquare = 7, CS = 7, + // ReSharper disable once IdentifierTypo KullbackLeibler = 8, KL = 8, Hamming = 9, diff --git a/src/OpenCvSharp/Modules/flann/Index.cs b/src/OpenCvSharp/Modules/flann/Index.cs index a11d6eda7..baf39d842 100644 --- a/src/OpenCvSharp/Modules/flann/Index.cs +++ b/src/OpenCvSharp/Modules/flann/Index.cs @@ -81,7 +81,7 @@ public void KnnSearch(float[] queries, out int[] indices, out float[] dists, int if (@params == null) throw new ArgumentNullException(nameof(@params)); if (queries.Length == 0) - throw new ArgumentException(); + throw new ArgumentException("empty array", nameof(queries)); if (knn < 1) throw new ArgumentOutOfRangeException(nameof(knn)); diff --git a/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs b/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs index 442098a0f..e9b771526 100644 --- a/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs +++ b/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs @@ -95,6 +95,8 @@ public void FilterByLabels(Mat src, Mat dst, IEnumerable labelValues) /// Filtered image. public void FilterByBlob(Mat src, Mat dst, Blob blob) { + if (blob == null) + throw new ArgumentNullException(nameof(blob)); FilterByLabels(src, dst, new[] { blob.Label }); } diff --git a/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs b/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs index 81a36e1d6..c155ff9f7 100644 --- a/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs +++ b/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs @@ -2,93 +2,41 @@ namespace OpenCvSharp { - -#if LANG_JP - /// - /// 3次元空間上の直線 - /// -#else /// /// A 3-dimensional line object /// -#endif public class Line3D { - #region Properties -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (x成分) - /// -#else /// /// The X component of the normalized vector collinear to the line /// -#endif public double Vx { get; set; } -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (y成分) - /// -#else + /// /// The Y component of the normalized vector collinear to the line /// -#endif public double Vy { get; set; } -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (z成分) - /// -#else + /// /// The Z component of the normalized vector collinear to the line /// -#endif public double Vz { get; set; } -#if LANG_JP - /// - /// 直線上の点のx座標 - /// -#else + /// /// X-coordinate of some point on the line /// -#endif public double X1 { get; set; } -#if LANG_JP - /// - /// 直線上の点のy座標 - /// -#else + /// /// Y-coordinate of some point on the line /// -#endif public double Y1 { get; set; } -#if LANG_JP - /// - /// 直線上の点のz座標 - /// -#else + /// /// Z-coordinate of some point on the line /// -#endif public double Z1 { get; set; } - #endregion - - #region Initialization -#if LANG_JP - /// - /// 初期化 - /// - /// 直線に乗るように正規化された方向ベクトル (x成分) - /// 直線に乗るように正規化された方向ベクトル (y成分) - /// 直線に乗るように正規化された方向ベクトル (z成分) - /// 直線上の点のx座標 - /// 直線上の点のy座標 - /// 直線上の点のz座標 -#else + /// /// Initializes this object /// @@ -98,7 +46,6 @@ public class Line3D /// Z-coordinate of some point on the line /// Z-coordinate of some point on the line /// Z-coordinate of some point on the line -#endif public Line3D(double vx, double vy, double vz, double x1, double y1, double z1) { Vx = vx; @@ -108,69 +55,50 @@ public Line3D(double vx, double vy, double vz, double x1, double y1, double z1) Y1 = y1; Z1 = z1; } -#if LANG_JP - /// - /// cvFitLineの出力(float[6])から初期化 - /// - /// cvFitLineの出力結果 -#else + /// /// Initializes by cvFitLine output /// /// The returned value from cvFitLineparam> -#endif public Line3D(float[] line) - : this(line[0], line[1], line[2], line[3], line[4], line[5]) { + if (line == null) + throw new ArgumentNullException(nameof(line)); + if (line.Length != 6) + throw new ArgumentException("array.Length != 6", nameof(line)); + + Vx = line[0]; + Vy = line[1]; + Vz = line[2]; + X1 = line[3]; + Y1 = line[4]; + Z1 = line[5]; } - #endregion - #region Methods -#if LANG_JP /// - /// + /// Perpendicular foot /// /// -#else - /// - /// - /// - /// -#endif public Point3d PerpendicularFoot(Point3f point) { return PerpendicularFoot(point.X, point.Y, point.Z); } -#if LANG_JP - /// - /// - /// - /// -#else + /// - /// + /// Perpendicular foot /// /// -#endif public Point3d PerpendicularFoot(Point3d point) { return PerpendicularFoot(point.X, point.Y, point.Z); } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// - /// - /// -#else + /// - /// Returns the distance between this line and the specified point + /// Perpendicular foot /// /// /// /// -#endif public Point3d PerpendicularFoot(double x, double y, double z) { var xa = X1; @@ -189,52 +117,30 @@ public Point3d PerpendicularFoot(double x, double y, double z) return new Point3d(hx, hy, hz); } - -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else /// /// Returns the distance between this line and the specified point /// /// -#endif public double Distance(Point3f point) { return Distance(point.X, point.Y, point.Z); } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else + /// /// Returns the distance between this line and the specified point /// /// -#endif public double Distance(Point3d point) { return Distance(point.X, point.Y, point.Z); } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// - /// - /// -#else + /// /// Returns the distance between this line and the specified point /// /// /// /// -#endif public double Distance(double x, double y, double z) { var p = new Point3d(x, y, z); @@ -291,6 +197,5 @@ private static double VertexDistance(Point3d p1, Point3d p2) (p2.Y - p1.Y) * (p2.Y - p1.Y) + (p2.Z - p1.Z) * (p2.Z - p1.Z)); } - #endregion } } \ No newline at end of file diff --git a/src/OpenCvSharp/Modules/imgproc/Moments.cs b/src/OpenCvSharp/Modules/imgproc/Moments.cs index e6f68ae01..c0d3d9828 100644 --- a/src/OpenCvSharp/Modules/imgproc/Moments.cs +++ b/src/OpenCvSharp/Modules/imgproc/Moments.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Runtime.InteropServices; using OpenCvSharp.Internal; @@ -252,8 +253,9 @@ public double[] HuMoments() #endregion - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] #pragma warning disable 1591 + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct NativeStruct { public double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */ diff --git a/src/OpenCvSharp/Modules/line_descriptors/KeyLine.cs b/src/OpenCvSharp/Modules/line_descriptors/KeyLine.cs index 32656336f..6e510a5e5 100644 --- a/src/OpenCvSharp/Modules/line_descriptors/KeyLine.cs +++ b/src/OpenCvSharp/Modules/line_descriptors/KeyLine.cs @@ -1,4 +1,8 @@ -namespace OpenCvSharp.LineDescriptor +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1051 + +namespace OpenCvSharp.LineDescriptor { /// /// A class to represent a line @@ -23,13 +27,14 @@ /// original image and in octave it was extracted from, about line's length and number of pixels it /// covers. /// + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public readonly struct KeyLine { /// /// orientation of the line /// public readonly float Angle; - + /// /// object ID, that can be used to cluster keylines by the line they represent /// diff --git a/src/OpenCvSharp/Modules/ml/DTrees.cs b/src/OpenCvSharp/Modules/ml/DTrees.cs index c7bc075df..e1e32de84 100644 --- a/src/OpenCvSharp/Modules/ml/DTrees.cs +++ b/src/OpenCvSharp/Modules/ml/DTrees.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using OpenCvSharp.Internal; using OpenCvSharp.Internal.Vectors; @@ -277,6 +278,9 @@ public Mat Priors } set { + if (value == null) + throw new ArgumentNullException(nameof(value)); + NativeMethods.HandleException( NativeMethods.ml_DTrees_setPriors(ptr, value.CvPtr)); GC.KeepAlive(this); @@ -361,6 +365,7 @@ public int[] GetSubsets() /// /// The class represents a decision tree node. /// + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct Node { /// @@ -405,6 +410,7 @@ public struct Node /// /// The class represents split in a decision tree. /// + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct Split { /// diff --git a/src/OpenCvSharp/Modules/ml/ParamGrid.cs b/src/OpenCvSharp/Modules/ml/ParamGrid.cs index 9f430c879..6207caed8 100644 --- a/src/OpenCvSharp/Modules/ml/ParamGrid.cs +++ b/src/OpenCvSharp/Modules/ml/ParamGrid.cs @@ -1,10 +1,13 @@ -#pragma warning disable CA1051 +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1051 namespace OpenCvSharp.ML { /// /// The structure represents the logarithmic grid range of statmodel parameters. /// + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct ParamGrid { /// diff --git a/src/OpenCvSharp/Modules/ml/SVM.cs b/src/OpenCvSharp/Modules/ml/SVM.cs index 30295a715..6da5e4e2e 100644 --- a/src/OpenCvSharp/Modules/ml/SVM.cs +++ b/src/OpenCvSharp/Modules/ml/SVM.cs @@ -255,6 +255,9 @@ public Mat ClassWeights } set { + if (value == null) + throw new ArgumentNullException(nameof(value)); + NativeMethods.HandleException( NativeMethods.ml_SVM_setClassWeights(ptr, value.CvPtr)); GC.KeepAlive(this); diff --git a/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs b/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs index f2f84f5b3..b85460397 100644 --- a/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs +++ b/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using OpenCvSharp.Internal; using OpenCvSharp.Internal.Vectors; @@ -2138,12 +2139,12 @@ public class DetectionROI /// /// set of requested locations to be evaluated /// - public Point[] Locations { get; } + public IReadOnlyList Locations { get; } /// /// vector that will contain confidence values for each location /// - public double[] Confidences { get; } + public IReadOnlyList Confidences { get; } /// /// Constructor diff --git a/src/OpenCvSharp/Modules/stitching/ImageFeatures.cs b/src/OpenCvSharp/Modules/stitching/ImageFeatures.cs index 265fbf7b3..a9749d4db 100644 --- a/src/OpenCvSharp/Modules/stitching/ImageFeatures.cs +++ b/src/OpenCvSharp/Modules/stitching/ImageFeatures.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; namespace OpenCvSharp.Detail @@ -60,6 +61,7 @@ public void Dispose() #pragma warning disable 1591 [StructLayout(LayoutKind.Sequential)] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct WImageFeatures { public int ImgIdx; diff --git a/src/OpenCvSharp/Modules/stitching/Stitcher.cs b/src/OpenCvSharp/Modules/stitching/Stitcher.cs index d18dfd772..395e0fffd 100644 --- a/src/OpenCvSharp/Modules/stitching/Stitcher.cs +++ b/src/OpenCvSharp/Modules/stitching/Stitcher.cs @@ -281,7 +281,8 @@ public Blender Blender } */ - public int[] Component + // TODO this should be method? + public IReadOnlyList Component { get { diff --git a/src/OpenCvSharp/Modules/tracking/TrackerCSRT.cs b/src/OpenCvSharp/Modules/tracking/TrackerCSRT.cs index 36795284a..b07d0e8bf 100644 --- a/src/OpenCvSharp/Modules/tracking/TrackerCSRT.cs +++ b/src/OpenCvSharp/Modules/tracking/TrackerCSRT.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using OpenCvSharp.Internal; @@ -88,6 +89,7 @@ protected override void DisposeUnmanaged() /// CSRT Params /// [StructLayout(LayoutKind.Sequential)] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct Params { #pragma warning disable 1591 diff --git a/src/OpenCvSharp/Modules/video/Tracker.cs b/src/OpenCvSharp/Modules/video/Tracker.cs index 4df456b4d..c4dee214a 100644 --- a/src/OpenCvSharp/Modules/video/Tracker.cs +++ b/src/OpenCvSharp/Modules/video/Tracker.cs @@ -16,7 +16,7 @@ public abstract class Tracker : Algorithm /// protected Tracker(Ptr ptrObj) { - PtrObj = ptrObj; + PtrObj = ptrObj ?? throw new ArgumentNullException(nameof(ptrObj)); ptr = ptrObj.Get(); } diff --git a/src/OpenCvSharp/Modules/video/TrackerMIL.cs b/src/OpenCvSharp/Modules/video/TrackerMIL.cs index 5f2f9e669..4edc2a7e8 100644 --- a/src/OpenCvSharp/Modules/video/TrackerMIL.cs +++ b/src/OpenCvSharp/Modules/video/TrackerMIL.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using OpenCvSharp.Internal; @@ -73,6 +74,7 @@ protected override void DisposeUnmanaged() /// /// [StructLayout(LayoutKind.Sequential)] + [SuppressMessage("Microsoft.Design", "CA1815: Override equals and operator equals on value types")] public struct Params { /// diff --git a/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs index b1d5a9feb..ce29663c2 100644 --- a/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs +++ b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs @@ -1,7 +1,4 @@ - -using System; - -#pragma warning disable CA1707 // Underscore +#pragma warning disable CA1707 // Underscore namespace OpenCvSharp { @@ -24,12 +21,7 @@ public enum VideoCaptureAPIs /// Auto detect == 0 /// ANY = 0, - - /// - /// Video For Windows (obsolete, removed) - /// - [Obsolete] VFW = 200, - + /// /// V4L/V4L2 capturing support /// @@ -64,17 +56,7 @@ public enum VideoCaptureAPIs /// Same value as CAP_FIREWIRE /// CMU1394 = FIREWIRE, - - /// - /// QuickTime (obsolete, removed) - /// - [Obsolete] QT = 500, - - /// - /// Unicap drivers (obsolete, removed) - /// - [Obsolete] UNICAP = 600, - + /// /// DirectShow (via videoInput) /// diff --git a/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategy.cs b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategy.cs index 3243328b6..1c8ea99c3 100644 --- a/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategy.cs +++ b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategy.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using OpenCvSharp.Internal; namespace OpenCvSharp.XImgProc.Segmentation @@ -69,6 +70,7 @@ public virtual void SetImage(InputArray img, InputArray regions, InputArray size /// /// The first region /// The second region + [SuppressMessage("Microsoft.Design", "CA1716: Identifiers should not match keywords")] public virtual float Get(int r1, int r2) { ThrowIfDisposed(); diff --git a/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategyMultiple.cs b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategyMultiple.cs index bcf52108a..6c0bf1408 100644 --- a/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategyMultiple.cs +++ b/src/OpenCvSharp/Modules/ximgproc/Segmentation/SelectiveSearchSegmentationStrategyMultiple.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; using OpenCvSharp.Internal; namespace OpenCvSharp.XImgProc.Segmentation @@ -52,6 +53,7 @@ protected SelectiveSearchSegmentationStrategyMultiple(IntPtr p) /// /// The first region /// The second region + [SuppressMessage("Microsoft.Design", "CA1716: Identifiers should not match keywords")] public new virtual float Get(int r1, int r2) { ThrowIfDisposed(); From 27b22d1904ffa18f72cf3a2da57f69fc8667fe8f Mon Sep 17 00:00:00 2001 From: shimat Date: Mon, 8 Feb 2021 00:02:32 +0900 Subject: [PATCH 2/3] remove LANG_JP --- OpenCvSharp.sln.DotSettings | 2 + src/OpenCvSharp.Extensions/Binarizer.cs | 49 --- src/OpenCvSharp.Extensions/BitmapConverter.cs | 51 +-- src/OpenCvSharp.Extensions/CvExtensions.cs | 24 +- .../BitmapSourceConverter.cs | 61 +-- .../WriteableBitmapConverter.cs | 55 +-- src/OpenCvSharp/Cv2/Cv2_calib3d.cs | 18 +- src/OpenCvSharp/Cv2/Cv2_core.cs | 2 +- src/OpenCvSharp/Cv2/Cv2_imgproc.cs | 344 +-------------- src/OpenCvSharp/Cv2/Cv2_video.cs | 2 +- src/OpenCvSharp/Fundamentals/CvObject.cs | 25 -- .../Fundamentals/DisposableCvObject.cs | 51 +-- .../Fundamentals/DisposableObject.cs | 114 +---- src/OpenCvSharp/Fundamentals/ICvPtrHolder.cs | 6 - .../Fundamentals/OpenCVException.cs | 55 +-- .../Fundamentals/OpenCvSharpException.cs | 6 - .../Modules/calib3d/Enum/CalibrationFlags.cs | 106 +---- .../Modules/calib3d/Enum/ChessboardFlags.cs | 24 -- .../calib3d/Enum/FundamentalMatMethod.cs | 64 --- .../calib3d/Enum/FundamentalMatMethods.cs | 32 ++ .../Modules/calib3d/Enum/HomographyMethods.cs | 26 -- .../calib3d/Enum/StereoRectificationFlags.cs | 25 +- src/OpenCvSharp/Modules/calib3d/StereoBM.cs | 7 - src/OpenCvSharp/Modules/calib3d/StereoSGBM.cs | 6 - .../Modules/core/Delegate/CvErrorCallback.cs | 12 - .../{imgproc => core}/Enum/BorderTypes.cs | 27 +- src/OpenCvSharp/Modules/core/Enum/CmpType.cs | 40 ++ src/OpenCvSharp/Modules/core/Enum/CmpTypes.cs | 87 ---- .../Modules/core/Enum/CovarFlags.cs | 55 --- .../{CriteriaType.cs => CriteriaTypes.cs} | 28 +- src/OpenCvSharp/Modules/core/Enum/DctFlags.cs | 25 -- .../Modules/core/Enum/DecompTypes.cs | 21 - src/OpenCvSharp/Modules/core/Enum/DftFlags.cs | 31 -- .../Modules/core/Enum/DistributionType.cs | 19 - .../Modules/core/Enum/GemmFlags.cs | 27 -- .../Modules/core/Enum/HersheyFonts.cs | 7 - .../Modules/core/Enum/KMeansFlags.cs | 6 - .../Modules/core/Enum/MatDiagType.cs | 8 - .../Modules/core/Enum/NormTypes.cs | 25 -- .../Modules/core/Enum/ReduceDimension.cs | 27 -- .../Modules/core/Enum/ReduceTypes.cs | 40 +- .../Modules/core/Enum/SortFlags.cs | 6 - src/OpenCvSharp/Modules/core/FileStorage.cs | 30 +- src/OpenCvSharp/Modules/core/Mat/Mat.cs | 260 ----------- src/OpenCvSharp/Modules/core/Mat/MatOfT.cs | 178 -------- .../Modules/core/Mat/Mat_CvMethods.cs | 329 +------------- src/OpenCvSharp/Modules/core/Mat/UMat.cs | 137 ------ src/OpenCvSharp/Modules/core/PCA.cs | 20 - src/OpenCvSharp/Modules/core/SVD.cs | 16 +- src/OpenCvSharp/Modules/core/SparseMat.cs | 35 -- .../Modules/core/Struct/KeyPoint.cs | 88 ---- src/OpenCvSharp/Modules/core/Struct/Point.cs | 69 --- .../Modules/core/Struct/Point2d.cs | 69 --- .../Modules/core/Struct/Point2f.cs | 70 --- .../Modules/core/Struct/Point3d.cs | 61 --- .../Modules/core/Struct/Point3f.cs | 18 - .../Modules/core/Struct/Point3i.cs | 61 --- src/OpenCvSharp/Modules/core/Struct/Rect.cs | 253 +---------- src/OpenCvSharp/Modules/core/Struct/Rect2d.cs | 265 +----------- src/OpenCvSharp/Modules/core/Struct/Rect2f.cs | 277 +----------- src/OpenCvSharp/Modules/core/Struct/Size.cs | 20 - src/OpenCvSharp/Modules/core/Struct/Size2d.cs | 18 - src/OpenCvSharp/Modules/core/Struct/Size2f.cs | 18 - .../Modules/core/Struct/TermCriteria.cs | 6 +- src/OpenCvSharp/Modules/cuda/GpuMat.cs | 146 +------ src/OpenCvSharp/Modules/cuda/Stream.cs | 23 +- src/OpenCvSharp/Modules/features2d/AKAZE.cs | 6 - .../features2d/DenseFeatureDetector.cs | 13 +- src/OpenCvSharp/Modules/features2d/MSER.cs | 8 +- .../Modules/flann/FlannCentersInit.cs | 30 +- src/OpenCvSharp/Modules/flann/Index.cs | 91 ---- .../flann/IndexParams/AutotunedIndexParams.cs | 20 - .../flann/IndexParams/CompositeIndexParams.cs | 17 - .../flann/IndexParams/KDTreeIndexParams.cs | 15 +- .../flann/IndexParams/KMeansIndexParams.cs | 18 +- .../flann/IndexParams/LinearIndexParams.cs | 8 +- .../flann/IndexParams/LshIndexParams.cs | 17 +- .../flann/IndexParams/SavedIndexParams.cs | 8 +- src/OpenCvSharp/Modules/highgui/CvTrackbar.cs | 58 +-- .../Modules/highgui/Enum/ButtonType.cs | 25 ++ .../Modules/highgui/Enum/ButtonTypes.cs | 51 --- .../Modules/highgui/MouseCallback.cs | 11 - .../Modules/highgui/TrackbarCallback.cs | 6 - src/OpenCvSharp/Modules/highgui/Window.cs | 231 +--------- .../Modules/imgcodecs/Enum/ImreadModes.cs | 41 -- .../Modules/imgcodecs/Enum/ImwriteFlags.cs | 24 -- .../Modules/imgcodecs/ImageEncodingParam.cs | 34 +- .../Modules/imgproc/ConnectedComponent.cs | 2 +- .../imgproc/Enum/AdaptiveThresholdTypes.cs | 26 +- .../imgproc/Enum/ColorConversionCodes.cs | 14 +- .../imgproc/Enum/ContourApproximationModes.cs | 44 +- ...eMaskSize.cs => DistanceTransformMasks.cs} | 11 +- .../Modules/imgproc/Enum/DistanceTypes.cs | 13 +- .../Modules/imgproc/Enum/FlipMode.cs | 29 +- .../Modules/imgproc/Enum/FloodFillFlags.cs | 35 -- .../Modules/imgproc/Enum/GrabCutModes.cs | 30 -- .../Modules/imgproc/Enum/HistCompMethods.cs | 43 +- .../Enum/{HoughMethods.cs => HoughModes.cs} | 16 +- .../imgproc/Enum/InterpolationFlags.cs | 45 +- .../Modules/imgproc/Enum/LineTypes.cs | 13 +- .../Modules/imgproc/Enum/MorphShapes.cs | 33 +- .../Modules/imgproc/Enum/MorphTypes.cs | 45 -- .../Modules/imgproc/Enum/PixelConnectivity.cs | 22 +- .../Modules/imgproc/Enum/RetrievalModes.cs | 50 +-- .../Modules/imgproc/Enum/ShapeMatchModes.cs | 13 +- .../imgproc/Enum/TemplateMatchModes.cs | 13 +- .../Modules/imgproc/Enum/ThresholdTypes.cs | 6 - .../Modules/imgproc/Model/CircleSegment.cs | 84 +--- .../Modules/imgproc/Model/Line2D.cs | 107 +---- .../Modules/imgproc/Model/Line3D.cs | 12 +- .../Modules/imgproc/Model/LineSegmentPoint.cs | 185 +------- .../Modules/imgproc/Model/LineSegmentPolar.cs | 148 +------ src/OpenCvSharp/Modules/imgproc/Subdiv2D.cs | 8 +- src/OpenCvSharp/Modules/ml/ANN_MLP.cs | 6 - src/OpenCvSharp/Modules/ml/DTrees.cs | 6 - src/OpenCvSharp/Modules/ml/EM.cs | 36 +- src/OpenCvSharp/Modules/ml/KNearest.cs | 6 - .../Modules/ml/NormalBayesClassifier.cs | 6 - src/OpenCvSharp/Modules/ml/RTrees.cs | 6 - src/OpenCvSharp/Modules/ml/SVM.cs | 7 - .../Modules/objdetect/CascadeClassifier.cs | 4 +- .../objdetect/Enum/HaarDetectionType.cs | 85 ---- .../objdetect/Enum/HaarDetectionTypes.cs | 42 ++ .../Modules/objdetect/HOGDescriptor.cs | 43 -- .../Modules/objdetect/HistogramNormType.cs | 19 - .../Modules/photo/InpaintMethod.cs | 28 +- .../Modules/videoio/Enum/CameraChannels.cs | 6 - .../Modules/videoio/Enum/CapturePosRatio.cs | 23 +- .../Modules/videoio/Enum/CaptureType.cs | 25 +- .../Modules/videoio/Enum/VideoCaptureAPIs.cs | 14 +- .../videoio/Enum/VideoCaptureProperties.cs | 130 +----- .../Modules/videoio/VideoCapture.cs | 404 +----------------- .../Modules/videoio/VideoWriter.cs | 103 +---- src/OpenCvSharp/Modules/xfeatures2d/FREAK.cs | 6 - src/OpenCvSharp/Modules/xfeatures2d/SURF.cs | 17 - .../Modules/xfeatures2d/StarDetector.cs | 6 - test/OpenCvSharp.Tests/TestBase.cs | 2 +- test/OpenCvSharp.Tests/calib3d/Calib3dTest.cs | 2 +- test/OpenCvSharp.Tests/core/CoreTest.cs | 2 +- .../OpenCvSharp.Tests/core/FileStorageTest.cs | 8 +- .../BOWImgDescriptorExtractorTest.cs | 2 +- test/OpenCvSharp.Tests/ml/SVMTest.cs | 6 +- tool/OpenCvSharp.ReleaseMaker/Packer.cs | 32 +- 143 files changed, 468 insertions(+), 6506 deletions(-) delete mode 100644 src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethod.cs create mode 100644 src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethods.cs rename src/OpenCvSharp/Modules/{imgproc => core}/Enum/BorderTypes.cs (67%) create mode 100644 src/OpenCvSharp/Modules/core/Enum/CmpType.cs delete mode 100644 src/OpenCvSharp/Modules/core/Enum/CmpTypes.cs rename src/OpenCvSharp/Modules/core/Enum/{CriteriaType.cs => CriteriaTypes.cs} (56%) create mode 100644 src/OpenCvSharp/Modules/highgui/Enum/ButtonType.cs delete mode 100644 src/OpenCvSharp/Modules/highgui/Enum/ButtonTypes.cs rename src/OpenCvSharp/Modules/imgproc/Enum/{DistanceMaskSize.cs => DistanceTransformMasks.cs} (64%) rename src/OpenCvSharp/Modules/imgproc/Enum/{HoughMethods.cs => HoughModes.cs} (80%) delete mode 100644 src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionType.cs create mode 100644 src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionTypes.cs diff --git a/OpenCvSharp.sln.DotSettings b/OpenCvSharp.sln.DotSettings index 45934edce..9ff420506 100644 --- a/OpenCvSharp.sln.DotSettings +++ b/OpenCvSharp.sln.DotSettings @@ -27,6 +27,7 @@ True True True + True True True True @@ -55,6 +56,7 @@ True True True + True True True True diff --git a/src/OpenCvSharp.Extensions/Binarizer.cs b/src/OpenCvSharp.Extensions/Binarizer.cs index 469c2a772..70c5dfc2b 100644 --- a/src/OpenCvSharp.Extensions/Binarizer.cs +++ b/src/OpenCvSharp.Extensions/Binarizer.cs @@ -2,27 +2,12 @@ namespace OpenCvSharp.Extensions { -#if LANG_JP - /// - /// 様々な二値化手法を集めたクラス (OpenCVの関数ではなく, OpenCvSharpが独自に実装したものである. 出来は保証しない.) - /// -#else /// /// Various binarization methods (ATTENTION : The methods of this class is not implemented in OpenCV) /// -#endif [Obsolete("Use CvXImgProc.NiblackThreshold instead.")] public static class Binarizer { -#if LANG_JP - /// - /// Niblackの手法による二値化処理を行う。 - /// - /// 入力画像 - /// 出力画像 - /// 局所領域のサイズ - /// 係数 -#else /// /// Binarizes by Niblack's method (This is faster but memory-hogging) /// @@ -30,7 +15,6 @@ public static class Binarizer /// Output image /// Window size /// Adequate coefficient -#endif public static void Niblack(Mat src, Mat dst, int kernelSize, double k) { if (src == null) @@ -99,16 +83,6 @@ public static void Niblack(Mat src, Mat dst, int kernelSize, double k) } } -#if LANG_JP - /// - /// Sauvolaの手法による二値化処理を行う。 - /// - /// 入力画像 - /// 出力画像 - /// 局所領域のサイズ - /// 係数 - /// 係数 -#else /// /// Binarizes by Sauvola's method (This is faster but memory-hogging) /// @@ -117,7 +91,6 @@ public static void Niblack(Mat src, Mat dst, int kernelSize, double k) /// Window size /// Adequate coefficient /// Adequate coefficient -#endif public static void Sauvola(Mat src, Mat dst, int kernelSize, double k, double r) { if (src == null) @@ -188,17 +161,6 @@ public static void Sauvola(Mat src, Mat dst, int kernelSize, double k, double r) } } - -#if LANG_JP - /// - /// Bernsenの手法による二値化処理を行う。 - /// - /// 入力画像 - /// 出力画像 - /// 局所領域のサイズ - /// この数値以下のコントラストの領域は背景領域とみなす - /// 背景領域と見なされた領域に適用する閾値(背景領域以外では、適応的に閾値を求める) -#else /// /// Binarizes by Bernsen's method /// @@ -207,7 +169,6 @@ public static void Sauvola(Mat src, Mat dst, int kernelSize, double k, double r) /// Window size /// Adequate coefficient /// Adequate coefficient -#endif public static void Bernsen(Mat src, Mat dst, int kernelSize, byte constrastMin, byte bgThreshold) { if (src == null) @@ -259,15 +220,6 @@ public static void Bernsen(Mat src, Mat dst, int kernelSize, byte constrastMin, } -#if LANG_JP - /// - /// Nickの手法による二値化処理を行う。 - /// - /// 入力画像 - /// 出力画像 - /// 局所領域のサイズ - /// 係数 -#else /// /// Binarizes by Nick's method /// @@ -275,7 +227,6 @@ public static void Bernsen(Mat src, Mat dst, int kernelSize, byte constrastMin, /// Output image /// Window size /// Adequate coefficient -#endif public static void Nick(Mat src, Mat dst, int kernelSize, double k) { if (src == null) diff --git a/src/OpenCvSharp.Extensions/BitmapConverter.cs b/src/OpenCvSharp.Extensions/BitmapConverter.cs index 5c0996b80..7fcbb997f 100644 --- a/src/OpenCvSharp.Extensions/BitmapConverter.cs +++ b/src/OpenCvSharp.Extensions/BitmapConverter.cs @@ -6,31 +6,18 @@ namespace OpenCvSharp.Extensions { -#if LANG_JP - /// - /// System.Drawing.BitmapとMatの相互変換メソッドを提供するクラス - /// -#else /// /// static class which provides conversion between System.Drawing.Bitmap and Mat /// -#endif public static class BitmapConverter { #region ToMat -#if LANG_JP - /// - /// System.Drawing.BitmapからOpenCVのMatへ変換して返す. - /// - /// 変換するSystem.Drawing.Bitmap - /// 変換結果のMat -#else + /// /// Converts System.Drawing.Bitmap to Mat /// /// System.Drawing.Bitmap object to be converted /// A Mat object which is converted from System.Drawing.Bitmap -#endif public static Mat ToMat(this Bitmap src) { if (src == null) @@ -59,19 +46,11 @@ public static Mat ToMat(this Bitmap src) return dst; } -#if LANG_JP - /// - /// System.Drawing.BitmapからOpenCVのMatへ変換して返す. - /// - /// 変換するSystem.Drawing.Bitmap - /// 変換結果を格納するMat -#else /// /// Converts System.Drawing.Bitmap to Mat /// /// System.Drawing.Bitmap object to be converted /// A Mat object which is converted from System.Drawing.Bitmap -#endif public static unsafe void ToMat(this Bitmap src, Mat dst) { if (src == null) @@ -332,19 +311,12 @@ void Format32bppRgb() #endregion #region ToBitmap -#if LANG_JP - /// - /// OpenCVのMatをSystem.Drawing.Bitmapに変換する - /// - /// 変換するMat - /// System.Drawing.Bitmap -#else + /// /// Converts Mat to System.Drawing.Bitmap /// /// Mat /// -#endif public static Bitmap ToBitmap(this Mat src) { if (src == null) @@ -366,21 +338,13 @@ public static Bitmap ToBitmap(this Mat src) } return ToBitmap(src, pf); } -#if LANG_JP - /// - /// OpenCVのMatをSystem.Drawing.Bitmapに変換する - /// - /// 変換するMat - /// ピクセル深度 - /// System.Drawing.Bitmap -#else + /// /// Converts Mat to System.Drawing.Bitmap /// /// Mat /// Pixel Depth /// -#endif public static Bitmap ToBitmap(this Mat src, PixelFormat pf) { if (src == null) @@ -392,21 +356,12 @@ public static Bitmap ToBitmap(this Mat src, PixelFormat pf) return bitmap; } -#if LANG_JP - /// - /// OpenCVのMatを指定した出力先にSystem.Drawing.Bitmapとして変換する - /// - /// 変換するMat - /// 出力先のSystem.Drawing.Bitmap - /// Author: shimat, Gummo (ROI support) -#else /// /// Converts Mat to System.Drawing.Bitmap /// /// Mat /// Mat /// Author: shimat, Gummo (ROI support) -#endif public static unsafe void ToBitmap(this Mat src, Bitmap dst) { if (src == null) diff --git a/src/OpenCvSharp.Extensions/CvExtensions.cs b/src/OpenCvSharp.Extensions/CvExtensions.cs index ab377e58a..294205624 100644 --- a/src/OpenCvSharp.Extensions/CvExtensions.cs +++ b/src/OpenCvSharp.Extensions/CvExtensions.cs @@ -3,36 +3,15 @@ //using System.Threading.Tasks; -#pragma warning disable 1591 - namespace OpenCvSharp.Extensions { -#if LANG_JP - /// - /// - /// -#else /// /// /// -#endif public static class CvExtensions { #region HoughLinesProbabilisticEx -#if LANG_JP - /// - /// 検出する線分の角度を指定できる確率的ハフ変換 - /// - /// 入力画像 - /// 距離解像度(1ピクセル当たりの単位) - /// 角度解像度(ラジアン単位) - /// 閾値パラメータ.対応する投票数がthresholdより大きい場合のみ,抽出された線が返される. - /// 最小の線の長さ - /// 同一線上に存在する線分として扱う,二つの線分の最大の間隔. - /// 検出する線分の角度の範囲の最小値 [0 <= θ <= π] - /// 検出する線分の角度の範囲の最大値 [0 <= θ <= π] - /// -#else + /// /// /// @@ -45,7 +24,6 @@ public static class CvExtensions /// /// /// -#endif public static LineSegmentPoint[] HoughLinesProbabilisticEx(this Mat img, double rho, double theta, int threshold, double minLineLength, double maxLineGap, double thetaMin = 0, double thetaMax = Math.PI) { diff --git a/src/OpenCvSharp.WpfExtensions/BitmapSourceConverter.cs b/src/OpenCvSharp.WpfExtensions/BitmapSourceConverter.cs index 9b5dc027d..bd98bd517 100644 --- a/src/OpenCvSharp.WpfExtensions/BitmapSourceConverter.cs +++ b/src/OpenCvSharp.WpfExtensions/BitmapSourceConverter.cs @@ -11,47 +11,22 @@ namespace OpenCvSharp.WpfExtensions { -#if LANG_JP - /// - /// System.Windows.Media.Imaging.WriteableBitmapとOpenCVのIplImageとの間の相互変換メソッドを提供するクラス - /// -#else /// /// Static class which provides conversion between System.Windows.Media.Imaging.BitmapSource and IplImage /// -#endif public static class BitmapSourceConverter { -#if LANG_JP - /// - /// MatをBitmapSourceに変換する. - /// - /// 変換するIplImage - /// WPFのBitmapSource -#else /// /// Converts Mat to BitmapSource. /// /// Input IplImage /// BitmapSource -#endif public static BitmapSource ToBitmapSource( this Mat src) { return src.ToWriteableBitmap(); } -#if LANG_JP - /// - /// MatをBitmapSourceに変換する. - /// - /// 変換するIplImage - /// - /// - /// - /// - /// WPFのBitmapSource -#else /// /// Converts Mat to BitmapSource. /// @@ -61,7 +36,6 @@ public static BitmapSource ToBitmapSource( /// /// /// BitmapSource -#endif public static BitmapSource ToBitmapSource( this Mat src, int horizontalResolution, @@ -72,20 +46,12 @@ public static BitmapSource ToBitmapSource( return src.ToWriteableBitmap(horizontalResolution, verticalResolution, pixelFormat, palette); } -#if LANG_JP - /// - /// System.Drawing.BitmapをBitmapSourceに変換する. - /// - /// 変換するBitmap - /// WPFのBitmapSource -#else /// /// Converts System.Drawing.Bitmap to BitmapSource. /// /// Input System.Drawing.Bitmap /// http://www.codeproject.com/Articles/104929/Bitmap-to-BitmapSource /// BitmapSource -#endif public static BitmapSource ToBitmapSource(this Bitmap src) { if (src == null) @@ -140,19 +106,12 @@ private static BitmapSource CreateBitmapSourceFromBitmap(Stream stream) } #region ToMat -#if LANG_JP - /// - /// BitmapSourceをMatに変換する - /// - /// 変換するBitmapSource - /// OpenCvSharpで扱えるMat -#else + /// /// Converts BitmapSource to Mat /// /// Input BitmapSource /// IplImage -#endif public static Mat ToMat(this BitmapSource src) { if (src == null) @@ -167,19 +126,12 @@ public static Mat ToMat(this BitmapSource src) ToMat(src, dst); return dst; } -#if LANG_JP - /// - /// BitmapSourceをMatに変換する. - /// - /// 変換するBitmapSource - /// 出力先のMat -#else + /// /// Converts BitmapSource to Mat /// /// Input BitmapSource /// Output Mat -#endif public static void ToMat(this BitmapSource src, Mat dst) { if (src == null) @@ -291,21 +243,12 @@ public static void ToMat(this BitmapSource src, Mat dst) } } -#if LANG_JP - /// - /// System.Windows.Media.Imaging.BitmapSource から Mat へピクセルデータをコピーする - /// - /// - /// - /// -#else /// /// Copies pixel data from System.Windows.Media.Imaging.BitmapSource to IplImage instance /// /// /// /// -#endif public static void CopyFrom(this Mat mat, BitmapSource wb) { if (wb == null) diff --git a/src/OpenCvSharp.WpfExtensions/WriteableBitmapConverter.cs b/src/OpenCvSharp.WpfExtensions/WriteableBitmapConverter.cs index 04b07ab73..a5cb9dcda 100644 --- a/src/OpenCvSharp.WpfExtensions/WriteableBitmapConverter.cs +++ b/src/OpenCvSharp.WpfExtensions/WriteableBitmapConverter.cs @@ -155,17 +155,6 @@ private static Mat SwapChannelsIfNeeded(Mat src) #region ToWriteableBitmap -#if LANG_JP - /// - /// MatをWriteableBitmapに変換する. 引数はWriteableBitmapのコンストラクタに相当する. - /// - /// 変換するMat - /// ビットマップの水平ドット/インチ (dpi) - /// ビットマップの垂直ドット/インチ (dpi) - /// ビットマップの PixelFormat - /// ビットマップの BitmapPalette - /// WPFのWriteableBitmap -#else /// /// Converts Mat to WriteableBitmap. /// The arguments of this method corresponds the consructor of WriteableBitmap. @@ -176,7 +165,6 @@ private static Mat SwapChannelsIfNeeded(Mat src) /// Pixel format of output WriteableBitmap /// Bitmap palette /// WriteableBitmap -#endif public static WriteableBitmap ToWriteableBitmap(this Mat src, double dpiX, double dpiY, PixelFormat pf, BitmapPalette? bp) { @@ -188,39 +176,22 @@ public static WriteableBitmap ToWriteableBitmap(this Mat src, double dpiX, doubl return wb; } -#if LANG_JP - /// - /// MatをWriteableBitmapに変換する (dpi=96, BitmapPalette=null) - /// - /// 変換するMat - /// ビットマップの PixelFormat - /// WPFのWriteableBitmap -#else /// /// Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null) /// /// Input Mat /// Pixel format of output WriteableBitmap /// WriteableBitmap -#endif public static WriteableBitmap ToWriteableBitmap(this Mat src, PixelFormat pf) { return ToWriteableBitmap(src, 96, 96, pf, null); } -#if LANG_JP - /// - /// MatをWriteableBitmapに変換する (dpi=96, BitmapPalette=null) - /// - /// 変換するMat - /// WPFのWriteableBitmap -#else /// /// Converts Mat to WriteableBitmap (dpi=96, BitmapPalette=null) /// /// Input Mat /// WriteableBitmap -#endif public static WriteableBitmap ToWriteableBitmap(this Mat src) { if (src == null) @@ -239,21 +210,12 @@ public static WriteableBitmap ToWriteableBitmap(this Mat src) } } -#if LANG_JP - /// - /// MatをWriteableBitmapに変換する. - /// 返却値を新たに生成せず引数で指定したWriteableBitmapに格納するので、メモリ効率が良い。 - /// - /// 変換するMat - /// 変換結果を設定するWriteableBitmap -#else /// /// Converts Mat to WriteableBitmap. /// This method is more efficient because new instance of WriteableBitmap is not allocated. /// /// Input Mat /// Output WriteableBitmap -#endif public static void ToWriteableBitmap(Mat src, WriteableBitmap dst) { if (src == null) @@ -365,19 +327,11 @@ public static void ToWriteableBitmap(Mat src, WriteableBitmap dst) // https://github.com/shimat/opencvsharp_2410/blob/master/src/OpenCvSharp.Extensions/WriteableBitmapConverter_IplImage.cs#L167 -#if LANG_JP - /// - /// WriteableBitmapをMatに変換する - /// - /// 変換するWriteableBitmap - /// OpenCvSharpで扱えるMat -#else /// /// Converts WriteableBitmap to IplImage /// /// Input WriteableBitmap /// IplImage -#endif public static Mat ToMat(this WriteableBitmap src) { if (src == null) @@ -392,19 +346,12 @@ public static Mat ToMat(this WriteableBitmap src) ToMat(src, dst); return dst; } -#if LANG_JP - /// - /// WriteableBitmapをMatに変換する. - /// - /// 変換するWriteableBitmap - /// 出力先のMat -#else + /// /// Converts WriteableBitmap to Mat /// /// Input WriteableBitmap /// Output Mat -#endif public static void ToMat(this WriteableBitmap src, Mat dst) { if (src == null) diff --git a/src/OpenCvSharp/Cv2/Cv2_calib3d.cs b/src/OpenCvSharp/Cv2/Cv2_calib3d.cs index 225e32a0a..064bf3710 100644 --- a/src/OpenCvSharp/Cv2/Cv2_calib3d.cs +++ b/src/OpenCvSharp/Cv2/Cv2_calib3d.cs @@ -1402,7 +1402,7 @@ public static double CalibrateCamera( distCoeffs.ThrowIfNotReady(); var criteria0 = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 30, Double.Epsilon)); + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 30, Double.Epsilon)); var objectPointsPtrs = objectPoints.Select(x => x.CvPtr).ToArray(); var imagePointsPtrs = imagePoints.Select(x => x.CvPtr).ToArray(); @@ -1472,7 +1472,7 @@ public static double CalibrateCamera( throw new ArgumentNullException(nameof(distCoeffs)); var criteria0 = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 30, Double.Epsilon)); + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 30, Double.Epsilon)); using var op = new ArrayAddress2(objectPoints); using var ip = new ArrayAddress2(imagePoints); @@ -1620,7 +1620,7 @@ public static double StereoCalibrate( var ip2Ptrs = imagePoints2.Select(x => x.CvPtr).ToArray(); var criteria0 = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 30, 1e-6)); + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 30, 1e-6)); NativeMethods.HandleException( NativeMethods.calib3d_stereoCalibrate_InputArray( @@ -1700,7 +1700,7 @@ public static double StereoCalibrate( throw new ArgumentNullException(nameof(distCoeffs2)); var criteria0 = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 30, 1e-6)); + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 30, 1e-6)); using var op = new ArrayAddress2(objectPoints); using var ip1 = new ArrayAddress2(imagePoints1); @@ -2731,7 +2731,7 @@ public static void ConvertPointsHomogeneous(InputArray src, OutputArray dst) /// fundamental matrix public static Mat FindFundamentalMat( InputArray points1, InputArray points2, - FundamentalMatMethod method = FundamentalMatMethod.Ransac, + FundamentalMatMethods method = FundamentalMatMethods.Ransac, double param1 = 3.0, double param2 = 0.99, OutputArray? mask = null) { @@ -2771,7 +2771,7 @@ public static Mat FindFundamentalMat( public static Mat FindFundamentalMat( IEnumerable points1, IEnumerable points2, - FundamentalMatMethod method = FundamentalMatMethod.Ransac, + FundamentalMatMethods method = FundamentalMatMethods.Ransac, double param1 = 3.0, double param2 = 0.99, OutputArray? mask = null) @@ -2812,7 +2812,7 @@ public static Mat FindFundamentalMat( public static Mat FindFundamentalMat( IEnumerable points1, IEnumerable points2, - FundamentalMatMethod method = FundamentalMatMethod.Ransac, + FundamentalMatMethods method = FundamentalMatMethods.Ransac, double param1 = 3.0, double param2 = 0.99, OutputArray? mask = null) @@ -4293,7 +4293,7 @@ public static double Calibrate( d.ThrowIfDisposed(); var criteriaVal = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 100, double.Epsilon)); + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 100, double.Epsilon)); using var objectPointsVec = new VectorOfMat(objectPoints); using var imagePointsVec = new VectorOfMat(imagePoints); @@ -4452,7 +4452,7 @@ public static double StereoCalibrate( t.ThrowIfNotReady(); var criteriaVal = criteria.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 100, double.Epsilon)); + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 100, double.Epsilon)); using var objectPointsVec = new VectorOfMat(objectPoints); using var imagePoints1Vec = new VectorOfMat(imagePoints1); diff --git a/src/OpenCvSharp/Cv2/Cv2_core.cs b/src/OpenCvSharp/Cv2/Cv2_core.cs index dda6dee03..761f6522a 100644 --- a/src/OpenCvSharp/Cv2/Cv2_core.cs +++ b/src/OpenCvSharp/Cv2/Cv2_core.cs @@ -1446,7 +1446,7 @@ public static void InRange(InputArray src, Scalar lowerb, Scalar upperb, OutputA /// output array of type ref CV_8U that has the same size and the same number of channels as the input arrays. /// a flag, that specifies correspondence between the arrays (cv::CmpTypes) // ReSharper disable once IdentifierTypo - public static void Compare(InputArray src1, InputArray src2, OutputArray dst, CmpTypes cmpop) + public static void Compare(InputArray src1, InputArray src2, OutputArray dst, CmpType cmpop) { if (src1 == null) throw new ArgumentNullException(nameof(src1)); diff --git a/src/OpenCvSharp/Cv2/Cv2_imgproc.cs b/src/OpenCvSharp/Cv2/Cv2_imgproc.cs index 87a23c1bd..3569ab708 100644 --- a/src/OpenCvSharp/Cv2/Cv2_imgproc.cs +++ b/src/OpenCvSharp/Cv2/Cv2_imgproc.cs @@ -848,7 +848,7 @@ public static void HoughLinesPointSet( /// Maximum circle radius. [By default this is 0] /// The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius) public static CircleSegment[] HoughCircles( - InputArray image, HoughMethods method, double dp, double minDist, + InputArray image, HoughModes method, double dp, double minDist, double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0) { if (image == null) @@ -1046,20 +1046,6 @@ public static void WarpAffine( dst.Fix(); } -#if LANG_JP - /// - /// 画像の透視変換を行います. - /// - /// 入力画像 - /// サイズが dsize で src と同じタイプの出力画像 - /// 3x3 の変換行列 - /// 出力画像のサイズ - /// 補間手法 - /// ピクセル外挿手法. - /// borderMode=BORDER_TRANSPARENT の場合,入力画像中の「はずれ値」に対応する - /// 出力画像中のピクセルが,この関数では変更されないことを意味します - /// 定数境界モードで利用されるピクセル値. -#else /// /// Applies a perspective transformation to an image. /// @@ -1071,7 +1057,6 @@ public static void WarpAffine( /// and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src). /// pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE). /// value used in case of a constant border; by default, it equals 0. -#endif public static void WarpPerspective( InputArray src, OutputArray dst, InputArray m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, @@ -1099,20 +1084,6 @@ public static void WarpPerspective( dst.Fix(); } -#if LANG_JP - /// - /// 画像の透視変換を行います. - /// - /// 入力画像 - /// サイズが dsize で src と同じタイプの出力画像 - /// 3x3 の変換行列 - /// 出力画像のサイズ - /// 補間手法 - /// ピクセル外挿手法. - /// borderMode=BORDER_TRANSPARENT の場合,入力画像中の「はずれ値」に対応する - /// 出力画像中のピクセルが,この関数では変更されないことを意味します - /// 定数境界モードで利用されるピクセル値. -#else /// /// Applies a perspective transformation to an image. /// @@ -1124,7 +1095,6 @@ public static void WarpPerspective( /// and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src). /// pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE). /// value used in case of a constant border; by default, it equals 0. -#endif public static void WarpPerspective( InputArray src, OutputArray dst, float[,] m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, @@ -2143,7 +2113,7 @@ public static void PyrMeanShiftFiltering(InputArray src, OutputArray dst, dst.ThrowIfNotReady(); var termcrit0 = termcrit.GetValueOrDefault( - new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 5, 1)); + new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 5, 1)); NativeMethods.HandleException( NativeMethods.imgproc_pyrMeanShiftFiltering(src.CvPtr, dst.CvPtr, sp, sr, maxLevel, termcrit0)); @@ -2214,7 +2184,7 @@ public static void DistanceTransformWithLabels(InputArray src, OutputArray dst, OutputArray labels, DistanceTypes distanceType, - DistanceMaskSize maskSize, + DistanceTransformMasks maskSize, DistanceTransformLabelTypes labelType = DistanceTransformLabelTypes.CComp) { if (src == null) @@ -2253,7 +2223,7 @@ public static void DistanceTransformWithLabels(InputArray src, public static void DistanceTransform(InputArray src, OutputArray dst, DistanceTypes distanceType, - DistanceMaskSize maskSize, + DistanceTransformMasks maskSize, int dstType = MatType.CV_32S) { if (src == null) @@ -2434,16 +2404,7 @@ public static void BlendLinear(InputArray src1, InputArray src2, InputArray weig GC.KeepAlive(weights2); dst.Fix(); } - -#if LANG_JP - /// - /// 画像の色空間を変換します. - /// - /// 8ビット符号なし整数型,16ビット符号なし整数型,または単精度浮動小数型の入力画像 - /// src と同じサイズ,同じタイプの出力画像 - /// 色空間の変換コード. - /// 出力画像のチャンネル数.この値が 0 の場合,チャンネル数は src と code から自動的に求められます -#else + /// /// Converts image from one color space to another /// @@ -2451,7 +2412,6 @@ public static void BlendLinear(InputArray src1, InputArray src2, InputArray weig /// The destination image; will have the same size and the same depth as src /// The color space conversion code /// The number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from src and the code -#endif public static void CvtColor(InputArray src, OutputArray dst, ColorConversionCodes code, int dstCn = 0) { if (src == null) @@ -2928,22 +2888,7 @@ public static ConnectedComponents ConnectedComponentsEx( } return new ConnectedComponents(blobs, labels, nLabels); } - -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// - /// 入力画像,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像 image の中身を書き換えます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. - /// 画像のトポロジーに関する情報を含む出力ベクトル.これは,輪郭数と同じ数の要素を持ちます.各輪郭 contours[i] に対して, - /// 要素 hierarchy[i]のメンバにはそれぞれ,同じ階層レベルに存在する前後の輪郭,最初の子輪郭,および親輪郭の - /// contours インデックス(0 基準)がセットされます.また,輪郭 i において,前後,親,子の輪郭が存在しない場合, - /// それに対応する hierarchy[i] の要素は,負の値になります. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. -#else + /// /// Finds contours in a binary image. /// @@ -2960,7 +2905,6 @@ public static ConnectedComponents ConnectedComponentsEx( /// Contour approximation method /// Optional offset by which every contour point is shifted. /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. -#endif public static void FindContours(InputArray image, out Point[][] contours, out HierarchyIndex[] hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) { @@ -2982,21 +2926,6 @@ public static void FindContours(InputArray image, out Point[][] contours, GC.KeepAlive(image); } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// - /// 入力画像,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像 image の中身を書き換えます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. - /// 画像のトポロジーに関する情報を含む出力ベクトル.これは,輪郭数と同じ数の要素を持ちます.各輪郭 contours[i] に対して, - /// 要素 hierarchy[i]のメンバにはそれぞれ,同じ階層レベルに存在する前後の輪郭,最初の子輪郭,および親輪郭の - /// contours インデックス(0 基準)がセットされます.また,輪郭 i において,前後,親,子の輪郭が存在しない場合, - /// それに対応する hierarchy[i] の要素は,負の値になります. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. -#else /// /// Finds contours in a binary image. /// @@ -3013,7 +2942,6 @@ public static void FindContours(InputArray image, out Point[][] contours, /// Contour approximation method /// Optional offset by which every contour point is shifted. /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. -#endif public static void FindContours(InputArray image, out Mat[] contours, OutputArray hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) { @@ -3036,17 +2964,6 @@ public static void FindContours(InputArray image, out Mat[] contours, GC.KeepAlive(hierarchy); } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// - /// 入力画像,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像 image の中身を書き換えます. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. -#else /// /// Finds contours in a binary image. /// @@ -3058,7 +2975,6 @@ public static void FindContours(InputArray image, out Mat[] contours, /// Optional offset by which every contour point is shifted. /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. /// Detected contours. Each contour is stored as a vector of points. -#endif public static Point[][] FindContoursAsArray(InputArray image, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) { @@ -3075,17 +2991,6 @@ public static Point[][] FindContoursAsArray(InputArray image, return contoursVec.ToArray(); } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// - /// 入力画像,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像 image の中身を書き換えます. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. -#else /// /// Finds contours in a binary image. /// @@ -3097,7 +3002,6 @@ public static Point[][] FindContoursAsArray(InputArray image, /// Optional offset by which every contour point is shifted. /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. /// Detected contours. Each contour is stored as a vector of points. -#endif public static Mat[] FindContoursAsMat(InputArray image, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) { @@ -4429,20 +4333,6 @@ public static void ApplyColorMap(InputArray src, OutputArray dst, InputArray use #region Drawing -#if LANG_JP - /// - /// 2点を結ぶ線分を画像上に描画する. - /// - /// 画像 - /// 線分の1番目の端点x - /// 線分の1番目の端点y - /// 線分の2番目の端点x - /// 線分の2番目の端点y - /// 線分の色 - /// 線分の太さ. [既定値は1] - /// 線分の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws a line segment connecting two points /// @@ -4455,25 +4345,12 @@ public static void ApplyColorMap(InputArray src, OutputArray dst, InputArray use /// Line thickness. [By default this is 1] /// Type of the line. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public static void Line(InputOutputArray img, int pt1X, int pt1Y, int pt2X, int pt2Y, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) { Line(img, new Point(pt1X, pt1Y), new Point(pt2X, pt2Y), color, thickness, lineType, shift); } -#if LANG_JP - /// - /// 2点を結ぶ線分を画像上に描画する. - /// - /// 画像 - /// 線分の1番目の端点 - /// 線分の2番目の端点 - /// 線分の色 - /// 線分の太さ. [既定値は1] - /// 線分の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws a line segment connecting two points /// @@ -4484,7 +4361,6 @@ public static void Line(InputOutputArray img, int pt1X, int pt1Y, int pt2X, int /// Line thickness. [By default this is 1] /// Type of the line. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public static void Line( InputOutputArray img, Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) @@ -4534,18 +4410,6 @@ public static void ArrowedLine( img.Fix(); } -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 画像 - /// 矩形の一つの頂点 - /// 矩形の反対側の頂点 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws simple, thick or filled rectangle /// @@ -4556,7 +4420,6 @@ public static void ArrowedLine( /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] /// Type of the line, see cvLine description. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public static void Rectangle( InputOutputArray img, Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) @@ -4571,18 +4434,7 @@ public static void Rectangle( img.Fix(); GC.KeepAlive(img); } - -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 画像 - /// 矩形 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else + /// /// Draws simple, thick or filled rectangle /// @@ -4593,7 +4445,6 @@ public static void Rectangle( /// Negative values make the function to draw a filled rectangle. [By default this is 1] /// Type of the line, see cvLine description. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public static void Rectangle( InputOutputArray img, Rect rect, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) @@ -4608,17 +4459,6 @@ public static void Rectangle( GC.KeepAlive(img); } -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 画像 - /// 矩形 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws simple, thick or filled rectangle /// @@ -4629,7 +4469,6 @@ public static void Rectangle( /// Negative values make the function to draw a filled rectangle. [By default this is 1] /// Type of the line, see cvLine description. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public static void Rectangle( Mat img, Rect rect, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) { @@ -4641,18 +4480,6 @@ public static void Rectangle( GC.KeepAlive(img); } -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 画像 - /// 矩形の一つの頂点 - /// 矩形の反対側の頂点 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws simple, thick or filled rectangle /// @@ -4664,7 +4491,6 @@ public static void Rectangle( /// Negative values make the function to draw a filled rectangle. [By default this is 1] /// Type of the line, see cvLine description. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public static void Rectangle( Mat img, Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) @@ -4677,19 +4503,6 @@ public static void Rectangle( GC.KeepAlive(img); } -#if LANG_JP - /// - /// 円を描画する - /// - /// 画像 - /// 円の中心のx座標 - /// 円の中心のy座標 - /// 円の半径 - /// 円の色 - /// 線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 中心座標と半径の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws a circle /// @@ -4701,25 +4514,12 @@ public static void Rectangle( /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] /// Type of the circle boundary. [By default this is LineType.Link8] /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] -#endif public static void Circle(InputOutputArray img, int centerX, int centerY, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) { Circle(img, new Point(centerX, centerY), radius, color, thickness, lineType, shift); } -#if LANG_JP - /// - /// 円を描画する - /// - /// 画像 - /// 円の中心 - /// 円の半径 - /// 円の色 - /// 線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 中心座標と半径の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws a circle /// @@ -4730,7 +4530,6 @@ public static void Circle(InputOutputArray img, int centerX, int centerY, int ra /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] /// Type of the circle boundary. [By default this is LineType.Link8] /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] -#endif public static void Circle(InputOutputArray img, Point center, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) { @@ -4744,21 +4543,6 @@ public static void Circle(InputOutputArray img, Point center, int radius, Scalar GC.KeepAlive(img); } -#if LANG_JP - /// - /// 枠だけの楕円,楕円弧,もしくは塗りつぶされた扇形の楕円を描画する - /// - /// 楕円が描画される画像 - /// 楕円の中心 - /// 楕円の軸の長さ - /// 回転角度 - /// 楕円弧の開始角度 - /// 楕円弧の終了角度 - /// 楕円の色 - /// 楕円弧の線の幅 [既定値は1] - /// 楕円弧の線の種類 [既定値はLineType.Link8] - /// 中心座標と軸の長さの小数点以下の桁を表すビット数 [既定値は0] -#else /// /// Draws simple or thick elliptic arc or fills ellipse sector /// @@ -4772,7 +4556,6 @@ public static void Circle(InputOutputArray img, Point center, int radius, Scalar /// Thickness of the ellipse arc. [By default this is 1] /// Type of the ellipse boundary. [By default this is LineType.Link8] /// Number of fractional bits in the center coordinates and axes' values. [By default this is 0] -#endif public static void Ellipse( InputOutputArray img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) @@ -4789,16 +4572,6 @@ public static void Ellipse( GC.KeepAlive(img); } -#if LANG_JP - /// - /// 枠だけの楕円,もしくは塗りつぶされた楕円を描画する - /// - /// 楕円が描かれる画像. - /// 描画したい楕円を囲む矩形領域. - /// 楕円の色. - /// 楕円境界線の幅.[既定値は1] - /// 楕円境界線の種類.[既定値はLineType.Link8] -#else /// /// Draws simple or thick elliptic arc or fills ellipse sector /// @@ -4807,7 +4580,6 @@ public static void Ellipse( /// Ellipse color. /// Thickness of the ellipse boundary. [By default this is 1] /// Type of the ellipse boundary. [By default this is LineType.Link8] -#endif public static void Ellipse(InputOutputArray img, RotatedRect box, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8) { @@ -4850,16 +4622,6 @@ public static void DrawMarker( GC.KeepAlive(img); } -#if LANG_JP - /// - /// 塗りつぶされた凸ポリゴンを描きます. - /// - /// 画像 - /// ポリゴンの頂点. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. -#else /// /// Fills a convex polygon. /// @@ -4868,7 +4630,6 @@ public static void DrawMarker( /// Polygon color /// Type of the polygon boundaries /// The number of fractional bits in the vertex coordinates -#endif public static void FillConvexPoly(Mat img, IEnumerable pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0) { @@ -4883,16 +4644,6 @@ public static void FillConvexPoly(Mat img, IEnumerable pts, Scalar color, GC.KeepAlive(img); } -#if LANG_JP - /// - /// 塗りつぶされた凸ポリゴンを描きます. - /// - /// 画像 - /// ポリゴンの頂点. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. -#else /// /// Fills a convex polygon. /// @@ -4901,7 +4652,6 @@ public static void FillConvexPoly(Mat img, IEnumerable pts, Scalar color, /// Polygon color /// Type of the polygon boundaries /// The number of fractional bits in the vertex coordinates -#endif public static void FillConvexPoly(InputOutputArray img, InputArray pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0) { @@ -4919,17 +4669,6 @@ public static void FillConvexPoly(InputOutputArray img, InputArray pts, Scalar c GC.KeepAlive(pts); } -#if LANG_JP - /// - /// 1つ,または複数のポリゴンで区切られた領域を塗りつぶします. - /// - /// 画像 - /// ポリゴンの配列.各要素は,点の配列で表現されます. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. - /// -#else /// /// Fills the area bounded by one or more polygons /// @@ -4939,7 +4678,6 @@ public static void FillConvexPoly(InputOutputArray img, InputArray pts, Scalar c /// Type of the polygon boundaries /// The number of fractional bits in the vertex coordinates /// -#endif public static void FillPoly( Mat img, IEnumerable> pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null) @@ -4972,17 +4710,6 @@ public static void FillPoly( GC.KeepAlive(img); } -#if LANG_JP - /// - /// 1つ,または複数のポリゴンで区切られた領域を塗りつぶします. - /// - /// 画像 - /// ポリゴンの配列.各要素は,点の配列で表現されます. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. - /// -#else /// /// Fills the area bounded by one or more polygons /// @@ -4992,7 +4719,6 @@ public static void FillPoly( /// Type of the polygon boundaries /// The number of fractional bits in the vertex coordinates /// -#endif public static void FillPoly( InputOutputArray img, InputArray pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null) @@ -5086,23 +4812,6 @@ public static void Polylines( GC.KeepAlive(pts); } -#if LANG_JP - /// - /// 輪郭線,または内側が塗りつぶされた輪郭を描きます. - /// - /// 出力画像 - /// 入力される全輪郭.各輪郭は,点のベクトルとして格納されています. - /// 描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます. - /// 輪郭の色. - /// 輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます. - /// 線の連結性 - /// 階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります. - /// 描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます. - /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と, - /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, - /// hierarchy が有効な場合のみ考慮されます. - /// 輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます. -#else /// /// draws contours in the image /// @@ -5119,7 +4828,6 @@ public static void Polylines( /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account /// when there is hierarchy available. /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) -#endif public static void DrawContours( InputOutputArray image, IEnumerable> contours, @@ -5162,23 +4870,6 @@ public static void DrawContours( image.Fix(); } -#if LANG_JP - /// - /// 輪郭線,または内側が塗りつぶされた輪郭を描きます. - /// - /// 出力画像 - /// 入力される全輪郭.各輪郭は,点のベクトルとして格納されています. - /// 描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます. - /// 輪郭の色. - /// 輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます. - /// 線の連結性 - /// 階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります. - /// 描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます. - /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と, - /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, - /// hierarchy が有効な場合のみ考慮されます. - /// 輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます. -#else /// /// draws contours in the image /// @@ -5195,7 +4886,6 @@ public static void DrawContours( /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account /// when there is hierarchy available. /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) -#endif public static void DrawContours( InputOutputArray image, IEnumerable contours, @@ -5226,15 +4916,6 @@ public static void DrawContours( GC.KeepAlive(hierarchy); } -#if LANG_JP - /// - /// 線分が画像矩形内に収まるように切り詰めます. - /// - /// 画像サイズ. - /// 線分の1番目の端点. - /// 線分の2番目の端点. - /// -#else /// /// Clips the line against the image rectangle /// @@ -5242,7 +4923,6 @@ public static void DrawContours( /// The first line point /// The second line point /// -#endif public static bool ClipLine(Size imgSize, ref Point pt1, ref Point pt2) { NativeMethods.HandleException( @@ -5250,15 +4930,6 @@ public static bool ClipLine(Size imgSize, ref Point pt1, ref Point pt2) return ret != 0; } -#if LANG_JP - /// - /// 線分が画像矩形内に収まるように切り詰めます. - /// - /// 画像矩形. - /// 線分の1番目の端点. - /// 線分の2番目の端点. - /// -#else /// /// Clips the line against the image rectangle /// @@ -5266,7 +4937,6 @@ public static bool ClipLine(Size imgSize, ref Point pt1, ref Point pt2) /// The first line point /// The second line point /// -#endif public static bool ClipLine(Rect imgRect, ref Point pt1, ref Point pt2) { NativeMethods.HandleException( diff --git a/src/OpenCvSharp/Cv2/Cv2_video.cs b/src/OpenCvSharp/Cv2/Cv2_video.cs index c37d1d502..b48e39745 100644 --- a/src/OpenCvSharp/Cv2/Cv2_video.cs +++ b/src/OpenCvSharp/Cv2/Cv2_video.cs @@ -397,7 +397,7 @@ public static double FindTransformECC( warpMatrix.ThrowIfDisposed(); inputMask?.ThrowIfDisposed(); - var criteriaValue = criteria.GetValueOrDefault(new TermCriteria(CriteriaType.Count | CriteriaType.Eps, 50, 0.001)); + var criteriaValue = criteria.GetValueOrDefault(new TermCriteria(CriteriaTypes.Count | CriteriaTypes.Eps, 50, 0.001)); NativeMethods.HandleException( NativeMethods.video_findTransformECC2( diff --git a/src/OpenCvSharp/Fundamentals/CvObject.cs b/src/OpenCvSharp/Fundamentals/CvObject.cs index bfead5583..af7de2354 100644 --- a/src/OpenCvSharp/Fundamentals/CvObject.cs +++ b/src/OpenCvSharp/Fundamentals/CvObject.cs @@ -2,15 +2,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// OpenCVのネイティブポインタをもったクラスの基本クラス - /// -#else /// /// A class which has a pointer of OpenCV structure /// -#endif public abstract class CvObject : ICvPtrHolder { /// @@ -18,44 +12,25 @@ public abstract class CvObject : ICvPtrHolder /// protected IntPtr ptr; -#if LANG_JP - /// - /// - /// -#else /// /// Default constructor /// -#endif protected CvObject() { } -#if LANG_JP - /// - /// - /// - /// -#else /// /// /// /// -#endif protected CvObject(IntPtr ptr) { this.ptr = ptr; } -#if LANG_JP - /// - /// OpenCVの構造体へのネイティブポインタ - /// -#else /// /// Native pointer of OpenCV structure /// -#endif public IntPtr CvPtr { get { return ptr; } diff --git a/src/OpenCvSharp/Fundamentals/DisposableCvObject.cs b/src/OpenCvSharp/Fundamentals/DisposableCvObject.cs index f0bbbc557..c7dd2bf26 100644 --- a/src/OpenCvSharp/Fundamentals/DisposableCvObject.cs +++ b/src/OpenCvSharp/Fundamentals/DisposableCvObject.cs @@ -1,16 +1,10 @@ using System; namespace OpenCvSharp -{ -#if LANG_JP - /// - /// リソースを解放すべきOpenCVのクラスに継承させる基本クラス - /// -#else +{ /// /// DisposableObject + ICvPtrHolder /// -#endif public abstract class DisposableCvObject : DisposableObject, ICvPtrHolder { /// @@ -18,66 +12,37 @@ public abstract class DisposableCvObject : DisposableObject, ICvPtrHolder /// protected IntPtr ptr; - #region Init and Dispose -#if LANG_JP - /// - /// - /// -#else /// /// Default constructor /// -#endif protected DisposableCvObject() : this(true) { } -#if LANG_JP /// - /// + /// Constructor /// /// -#else - /// - /// - /// - /// -#endif protected DisposableCvObject(IntPtr ptr) : this(ptr, true) { } -#if LANG_JP /// - /// + /// Constructor /// /// -#else - /// - /// - /// - /// -#endif protected DisposableCvObject(bool isEnabledDispose) : this(IntPtr.Zero, isEnabledDispose) { } -#if LANG_JP - /// - /// - /// - /// - /// -#else /// - /// + /// Constructor /// /// /// -#endif protected DisposableCvObject(IntPtr ptr, bool isEnabledDispose) : base(isEnabledDispose) { @@ -93,17 +58,9 @@ protected override void DisposeUnmanaged() base.DisposeUnmanaged(); } - #endregion - -#if LANG_JP - /// - /// OpenCVの構造体へのネイティブポインタ - /// -#else /// /// Native pointer of OpenCV structure /// -#endif public IntPtr CvPtr { get diff --git a/src/OpenCvSharp/Fundamentals/DisposableObject.cs b/src/OpenCvSharp/Fundamentals/DisposableObject.cs index 473672e84..dcf2c4466 100644 --- a/src/OpenCvSharp/Fundamentals/DisposableObject.cs +++ b/src/OpenCvSharp/Fundamentals/DisposableObject.cs @@ -2,19 +2,11 @@ using System.Runtime.InteropServices; using System.Threading; -#pragma warning disable CA1720 // Identifiers should not contain type names - namespace OpenCvSharp { -#if LANG_JP - /// - /// 解放処理を行うクラスが継承するための基本クラス - /// -#else /// /// Represents a class which manages its own memory. /// -#endif public abstract class DisposableObject : IDisposable { /// @@ -24,83 +16,38 @@ public abstract class DisposableObject : IDisposable private volatile int disposeSignaled = 0; - #region Properties -#if LANG_JP - /// - /// リソースが解放済みかどうかを取得する - /// -#else /// /// Gets a value indicating whether this instance has been disposed. /// -#endif public bool IsDisposed { get; protected set; } -#if LANG_JP - /// - /// 解放処理を許可するかどうかを取得・設定する. falseならばDisposeは何もしない. - /// 通常はユーザはこのフラグを変更してはならない. CvCapture.QueryFrameで取得したIplImageのように, - /// 解放処理をするとエラーとなるオブジェクトの場合に自動的にこのフラグがfalseとなる。 - /// -#else /// /// Gets or sets a value indicating whether you permit disposing this instance. /// -#endif public bool IsEnabledDispose { get; set; } - -#if LANG_JP - /// - /// cvCreateXXX といった関数がなく自前で構造体の分のメモリを確保する場合、 - /// そのアドレスを入れておく場所 - /// -#else /// /// Gets or sets a memory address allocated by AllocMemory. /// -#endif protected IntPtr AllocatedMemory { get; set; } -#if LANG_JP - /// - /// AllocatedMemoryに確保されているメモリのサイズ - /// -#else /// /// Gets or sets the byte length of the allocated memory /// -#endif protected long AllocatedMemorySize { get; set; } - #endregion - - #region Init and Dispossal -#if LANG_JP - /// - /// デフォルトコンストラクタ - /// -#else /// /// Default constructor /// -#endif protected DisposableObject() : this(true) { } -#if LANG_JP - /// - /// 解放の可否を指定して初期化 - /// - /// GCで解放するならtrue -#else /// /// Constructor /// /// true if you permit disposing this class by GC -#endif protected DisposableObject(bool isEnabledDispose) { IsDisposed = false; @@ -109,30 +56,15 @@ protected DisposableObject(bool isEnabledDispose) AllocatedMemorySize = 0; } -#if LANG_JP - /// - /// リソースの解放 - /// -#else /// /// Releases the resources /// -#endif public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } -#if LANG_JP - /// - /// リソースの解放 - /// - /// - /// trueの場合は、このメソッドがユーザコードから直接が呼ばれたことを示す。マネージ・アンマネージ双方のリソースが解放される。 - /// falseの場合は、このメソッドはランタイムからファイナライザによって呼ばれ、もうほかのオブジェクトから参照されていないことを示す。アンマネージリソースのみ解放される。 - /// -#else /// /// Releases the resources /// @@ -140,7 +72,6 @@ public void Dispose() /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed. /// -#endif protected virtual void Dispose(bool disposing) { #pragma warning disable 420 @@ -162,15 +93,9 @@ protected virtual void Dispose(bool disposing) } } -#if LANG_JP - /// - /// デストラクタ - /// -#else /// /// Destructor /// -#endif ~DisposableObject() { Dispose(false); @@ -203,23 +128,12 @@ protected virtual void DisposeUnmanaged() AllocatedMemory = IntPtr.Zero; } } - - #endregion - - #region Methods - -#if LANG_JP - /// - /// cvSetDataで割り当てる配列データをGCHandleでピン止めする - /// - /// -#else + /// /// Pins the object to be allocated by cvSetData. /// /// /// -#endif // ReSharper disable once InconsistentNaming protected internal GCHandle AllocGCHandle(object obj) { @@ -232,19 +146,11 @@ protected internal GCHandle AllocGCHandle(object obj) return DataHandle; } -#if LANG_JP - /// - /// 指定したサイズの量のメモリを割り当てる。 - /// Dispose時に解放する - /// - /// 割り当てたメモリ -#else /// /// Allocates the specified size of memory. /// /// /// -#endif protected IntPtr AllocMemory(int size) { if (size <= 0) @@ -257,20 +163,10 @@ protected IntPtr AllocMemory(int size) return AllocatedMemory; } -#if LANG_JP - /// - /// アンマネージメモリを確保したメモリサイズを通知する。 - /// - /// 実際に確保するならAllocMemoryのほうを使う。 - /// 確保はcvCreateXXXがやってくれるという場合はこっちを使う - /// - /// -#else /// /// Notifies the allocated size of memory. /// /// -#endif protected void NotifyMemoryPressure(long size) { // マルチスレッド動作時にロックがかかるらしい。いったん廃止 @@ -288,21 +184,13 @@ protected void NotifyMemoryPressure(long size) GC.AddMemoryPressure(size); } -#if LANG_JP - /// - /// このオブジェクトが解放済みの場合はObjectDisposedExceptionを投げる - /// -#else /// /// If this object is disposed, then ObjectDisposedException is thrown. /// -#endif public void ThrowIfDisposed() { if (IsDisposed) throw new ObjectDisposedException(GetType().FullName); } - - #endregion } } diff --git a/src/OpenCvSharp/Fundamentals/ICvPtrHolder.cs b/src/OpenCvSharp/Fundamentals/ICvPtrHolder.cs index e3ff4aaa6..fdee91252 100644 --- a/src/OpenCvSharp/Fundamentals/ICvPtrHolder.cs +++ b/src/OpenCvSharp/Fundamentals/ICvPtrHolder.cs @@ -2,15 +2,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// OpenCVのネイティブデータポインタを持つことを示すインターフェイス - /// -#else /// /// Represents a OpenCV-based class which has a native pointer. /// -#endif public interface ICvPtrHolder { /// diff --git a/src/OpenCvSharp/Fundamentals/OpenCVException.cs b/src/OpenCvSharp/Fundamentals/OpenCVException.cs index 7af87ad28..f7502e5d7 100644 --- a/src/OpenCvSharp/Fundamentals/OpenCVException.cs +++ b/src/OpenCvSharp/Fundamentals/OpenCVException.cs @@ -3,88 +3,38 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// OpenCVから投げられる例外 - /// -#else /// /// The default exception to be thrown by OpenCV /// -#endif [Serializable] // ReSharper disable once InconsistentNaming public class OpenCVException : Exception { - #region Properties - -#if LANG_JP - /// - /// エラーステータス - /// -#else /// /// The numeric code for error status /// -#endif public ErrorCode Status { get; set; } -#if LANG_JP - /// - /// エラーが発生したOpenCVの関数名. - /// -#else /// /// The source file name where error is encountered /// -#endif public string FuncName { get; set; } -#if LANG_JP - /// - /// エラーについての追加情報/診断結果 - /// -#else /// /// A description of the error /// -#endif public string ErrMsg { get; set; } -#if LANG_JP - /// - /// エラーが発生したファイル名 - /// -#else /// /// The source file name where error is encountered /// -#endif public string FileName { get; set; } -#if LANG_JP - /// - /// エラーが発生した行番号 - /// -#else /// /// The line number in the source where error is encountered /// -#endif public int Line { get; set; } - #endregion - -#if LANG_JP - /// - /// 初期化 - /// - /// エラーステータス - /// エラーが発生した関数名 - /// エラーについての追加情報/診断結果 - /// エラーが発生したファイル名 - /// エラーが発生した行番号 -#else /// /// Constructor /// @@ -92,8 +42,7 @@ public class OpenCVException : Exception /// The source file name where error is encountered /// A description of the error /// The source file name where error is encountered - /// The line number in the souce where error is encountered -#endif + /// The line number in the source where error is encountered public OpenCVException(ErrorCode status, string funcName, string errMsg, string fileName, int line) : base(errMsg) { @@ -104,7 +53,6 @@ public OpenCVException(ErrorCode status, string funcName, string errMsg, string Line = line; } - /// protected OpenCVException(SerializationInfo info, StreamingContext context) : base(info, context) { @@ -115,7 +63,6 @@ protected OpenCVException(SerializationInfo info, StreamingContext context) : ba Line = info.GetInt32(nameof(Line)); } - /// public override void GetObjectData(SerializationInfo info, StreamingContext context) { diff --git a/src/OpenCvSharp/Fundamentals/OpenCvSharpException.cs b/src/OpenCvSharp/Fundamentals/OpenCvSharpException.cs index 9013452dc..8631876d0 100644 --- a/src/OpenCvSharp/Fundamentals/OpenCvSharpException.cs +++ b/src/OpenCvSharp/Fundamentals/OpenCvSharpException.cs @@ -3,15 +3,9 @@ namespace OpenCvSharp { -#if LANG_JP -/// -/// OpenCvSharpから投げられる例外 -/// -#else /// /// The exception that is thrown by OpenCvSharp. /// -#endif [Serializable] public class OpenCvSharpException : Exception { diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/CalibrationFlags.cs b/src/OpenCvSharp/Modules/calib3d/Enum/CalibrationFlags.cs index 03b8f9752..40b784a97 100644 --- a/src/OpenCvSharp/Modules/calib3d/Enum/CalibrationFlags.cs +++ b/src/OpenCvSharp/Modules/calib3d/Enum/CalibrationFlags.cs @@ -2,15 +2,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cvCalibrateCamera2やcvStereoCalibrateの処理フラグ - /// -#else /// /// Different flags for cvCalibrateCamera2 and cvStereoCalibrate /// -#endif [Flags] public enum CalibrationFlags { @@ -19,152 +13,69 @@ public enum CalibrationFlags /// None = 0, -#if LANG_JP - /// - /// intrinsic_matrixは最適化が行われた正しい初 期値 fx, fy, cx, cyを含む.このパラメータがセッ トされていない場合,(cx, cy) は最初に画像中心にセットされ(image_size はこの計算に用いられ る),焦点距離は最小二乗法で計算される. - /// -#else /// /// The flag allows the function to optimize some or all of the intrinsic parameters, depending on the other flags, but the initial values are provided by the user /// -#endif UseIntrinsicGuess = 0x00001, -#if LANG_JP - /// - /// fx と fy のうちのどちらか一方だけが独立変数であるとし,アスペクト比 fx/fy が intrinsic_matrix の初期値として与えられた値か ら変わらないように最適化処理を行う. - /// この場合,実際に用いられる(fx, fy)の初期値は,行列から与えられる (CV_CALIB_USE_INTRINSIC_GUESSがセットされている場合)か,何らかの方法で推定される(後者の場合は, fx, fy は任意の値にセットされ,それらの比率だけが用いられる). - /// -#else /// /// fyk is optimized, but the ratio fxk/fyk is fixed. /// -#endif FixAspectRatio = 0x00002, -#if LANG_JP - /// - /// 主点(光学中心) は最適化中には変化せず,中心または別の指定された場所(このパラメータと同時 に UseIntrinsicGuess がセットされ ている場合)に固定される - /// -#else /// /// The principal points are fixed during the optimization. /// -#endif FixPrincipalPoint = 0x00004, -#if LANG_JP - /// - /// 円周方向の歪み係数は0にセットされ,最適化中は変化しない - /// -#else /// /// Tangential distortion coefficients are set to zeros and do not change during the optimization. /// -#endif ZeroTangentDist = 0x00008, -#if LANG_JP - /// - /// fxk および fyk が固定される. - /// -#else /// /// fxk and fyk are fixed. /// -#endif FixFocalLength = 0x00010, -#if LANG_JP - /// - /// 0 番目の歪み係数(k1)が固定される. - /// -#else /// /// The 0-th distortion coefficients (k1) are fixed /// -#endif FixK1 = 0x00020, - -#if LANG_JP - /// - /// 1 番目の歪み係数(k2)が固定される. - /// -#else /// /// The 1-th distortion coefficients (k2) are fixed /// -#endif FixK2 = 0x00040, - -#if LANG_JP - /// - /// 4 番目の歪み係数(k3)が固定される. - /// -#else /// /// The 4-th distortion coefficients (k3) are fixed /// -#endif FixK3 = 0x00080, - -#if LANG_JP - /// - /// 最適化中に,指定した半径方向の歪み係数を変更しません. - /// CV_CALIB_USE_INTRINSIC_GUESS が指定されている場合は,与えられた distCoeffs 行列の係数が利用されます.そうでない場合は,0が利用されます. - /// -#else /// /// Do not change the corresponding radial distortion coefficient during the optimization. /// If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used, otherwise it is set to 0. /// -#endif FixK4 = 0x00800, - -#if LANG_JP - /// - /// 最適化中に,指定した半径方向の歪み係数を変更しません. - /// CV_CALIB_USE_INTRINSIC_GUESS が指定されている場合は,与えられた distCoeffs 行列の係数が利用されます.そうでない場合は,0が利用されます. - /// -#else /// /// Do not change the corresponding radial distortion coefficient during the optimization. /// If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used, otherwise it is set to 0. /// -#endif FixK5 = 0x01000, - -#if LANG_JP - /// - /// 最適化中に,指定した半径方向の歪み係数を変更しません. - /// CV_CALIB_USE_INTRINSIC_GUESS が指定されている場合は,与えられた distCoeffs 行列の係数が利用されます.そうでない場合は,0が利用されます. - /// -#else /// /// Do not change the corresponding radial distortion coefficient during the optimization. /// If CV_CALIB_USE_INTRINSIC_GUESS is set, the coefficient from the supplied distCoeffs matrix is used, otherwise it is set to 0. /// -#endif FixK6 = 0x02000, - -#if LANG_JP - /// - /// 係数 k4, k5, k6 を有効にします. - /// 後方互換性を保つためには,このフラグを明示的に指定して,キャリブレーション関数が rational モデルを利用して8個の係数を返すようにします. - /// このフラグが指定されない場合,関数は5つの歪み係数のみを計算し ます. - /// -#else + /// /// Enable coefficients k4, k5 and k6. /// To provide the backward compatibility, this extra flag should be explicitly specified to make the calibration function /// use the rational model and return 8 coefficients. If the flag is not set, the function will compute only 5 distortion coefficients. /// -#endif RationalModel = 0x04000, /// @@ -177,26 +88,14 @@ public enum CalibrationFlags /// FixS1S2S3S4 = 0x08000, -#if LANG_JP - /// - /// これがセットされた場合,外部パラメータのみが最適化されるように, camera_matrix1,2 と dist_coeffs1,2 が固定される. - /// -#else /// /// If it is set, camera_matrix1,2, as well as dist_coeffs1,2 are fixed, so that only extrinsic parameters are optimized. /// -#endif FixIntrinsic = 0x00100, -#if LANG_JP - /// - /// 強制的に,fx0=fx1, fy0=fy1 とする. - /// -#else /// /// Enforces fx0=fx1 and fy0=fy1. CV_CALIB_ZERO_TANGENT_DIST - Tangential distortion coefficients for each camera are set to zeros and fixed there. /// -#endif SameFocalLength = 0x00200, /// @@ -205,6 +104,3 @@ public enum CalibrationFlags ZeroDisparity = 0x00400, } } - - - diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/ChessboardFlags.cs b/src/OpenCvSharp/Modules/calib3d/Enum/ChessboardFlags.cs index 79d759f4d..518abb32f 100644 --- a/src/OpenCvSharp/Modules/calib3d/Enum/ChessboardFlags.cs +++ b/src/OpenCvSharp/Modules/calib3d/Enum/ChessboardFlags.cs @@ -4,15 +4,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cvFindChessboardCornersの処理フラグ - /// -#else /// /// Various operation flags for cvFindChessboardCorners /// -#endif [Flags] public enum ChessboardFlags { @@ -21,38 +15,20 @@ public enum ChessboardFlags /// None = 0, -#if LANG_JP - /// - /// 画像を二値化する際に,固定の閾値を使うのではなく,(画像の平均輝度値から計算される)適応的な閾値を用いる - /// -#else /// /// Use adaptive thresholding to convert the image to black-n-white, rather than a fixed threshold level (computed from the average image brightness). /// -#endif AdaptiveThresh = 1, -#if LANG_JP - /// - /// 固定閾値処理または適応的閾値処理を行う前に,cvNormalizeHistを用いて画像を正規化する - /// -#else /// /// Normalize the image using cvNormalizeHist before applying fixed or adaptive thresholding. /// -#endif NormalizeImage = 2, -#if LANG_JP - /// - /// 輪郭の探索 段階で抽出される間違った四角形を無視するために,追加基準(輪郭面積,周囲長,形は正方形など)を使用する - /// -#else /// /// Use additional criteria (like contour area, perimeter, square-like shape) to filter out false quads /// that are extracted at the contour retrieval stage. /// -#endif FilterQuads = 4, /// diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethod.cs b/src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethod.cs deleted file mode 100644 index 5b112bc23..000000000 --- a/src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethod.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// 基礎行列の計算手法 - /// -#else - /// - /// Method for computing the fundamental matrix - /// -#endif - [Flags] - public enum FundamentalMatMethod - { -#if LANG_JP - /// - /// 7-pointアルゴリズム. N == 7 - /// -#else - /// - /// for 7-point algorithm. N == 7 - /// -#endif - Point7 = 1, - -#if LANG_JP - /// - /// 8-pointアルゴリズム. N > 8 - /// -#else - /// - /// for 8-point algorithm. N >= 8 - /// [CV_FM_8POINT] - /// -#endif - Point8 = 2, - -#if LANG_JP - /// - /// LMedSアルゴリズム. N >= 8 - /// -#else - /// - /// for LMedS algorithm. N > 8 - /// -#endif - LMedS = 4, - - -#if LANG_JP - /// - /// RANSAC アルゴリズム. N > 8 - /// [CV_FM_RANSAC] - /// -#else - /// - /// for RANSAC algorithm. N > 8 - /// -#endif - Ransac = 8, - } -} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethods.cs b/src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethods.cs new file mode 100644 index 000000000..7ede3b3cf --- /dev/null +++ b/src/OpenCvSharp/Modules/calib3d/Enum/FundamentalMatMethods.cs @@ -0,0 +1,32 @@ +using System; + +namespace OpenCvSharp +{ + /// + /// Method for computing the fundamental matrix + /// + [Flags] + public enum FundamentalMatMethods + { + /// + /// for 7-point algorithm. N == 7 + /// + Point7 = 1, + + /// + /// for 8-point algorithm. N >= 8 + /// [CV_FM_8POINT] + /// + Point8 = 2, + + /// + /// for LMedS algorithm. N > 8 + /// + LMedS = 4, + + /// + /// for RANSAC algorithm. N > 8 + /// + Ransac = 8, + } +} diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/HomographyMethods.cs b/src/OpenCvSharp/Modules/calib3d/Enum/HomographyMethods.cs index ca7c9bb8a..0f1823193 100644 --- a/src/OpenCvSharp/Modules/calib3d/Enum/HomographyMethods.cs +++ b/src/OpenCvSharp/Modules/calib3d/Enum/HomographyMethods.cs @@ -2,51 +2,25 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// ホモグラフィ行列を計算するための手法 - /// -#else /// /// The method used to computed homography matrix /// -#endif [Flags] public enum HomographyMethods { -#if LANG_JP - /// - /// 全ての点のペアを利用する標準的な手法 - /// -#else /// /// Regular method using all the point pairs /// -#endif None = 0, - -#if LANG_JP - /// - /// LMedS推定によるロバストな手法 - /// -#else /// /// Least-Median robust method /// -#endif LMedS = 4, - -#if LANG_JP - /// - /// RANSACアルゴリズムに基づくロバストな手法 - /// -#else /// /// RANSAC-based robust method /// -#endif Ransac = 8, /// diff --git a/src/OpenCvSharp/Modules/calib3d/Enum/StereoRectificationFlags.cs b/src/OpenCvSharp/Modules/calib3d/Enum/StereoRectificationFlags.cs index 02bdb1bad..7fcd1a43d 100644 --- a/src/OpenCvSharp/Modules/calib3d/Enum/StereoRectificationFlags.cs +++ b/src/OpenCvSharp/Modules/calib3d/Enum/StereoRectificationFlags.cs @@ -1,39 +1,22 @@ -namespace OpenCvSharp +using System; + +namespace OpenCvSharp { -#if LANG_JP - /// - /// 輪郭の近似手法 - /// -#else /// /// The operation flags for cvStereoRectify /// -#endif + [Flags] public enum StereoRectificationFlags { -#if LANG_JP - /// - /// フラグなし (=0). - /// 利用できる画像領域が最大になるように(エピポーラ線の傾きに従って)片方の画像を水平・垂直方向に移動する. - /// -#else /// /// Default value (=0). /// the function can shift one of the image in horizontal or vertical direction (depending on the orientation of epipolar lines) in order to maximise the useful image area. /// -#endif None = 0, - -#if LANG_JP - /// - /// 平行化後のビューにおいて各カメラの主点(光学中心)が同じ座標になるようにする. - /// -#else /// /// the function makes the principal points of each camera have the same pixel coordinates in the rectified views. /// -#endif ZeroDisparity = 1024, }; } \ No newline at end of file diff --git a/src/OpenCvSharp/Modules/calib3d/StereoBM.cs b/src/OpenCvSharp/Modules/calib3d/StereoBM.cs index 3cce60aac..af990df84 100644 --- a/src/OpenCvSharp/Modules/calib3d/StereoBM.cs +++ b/src/OpenCvSharp/Modules/calib3d/StereoBM.cs @@ -4,17 +4,10 @@ namespace OpenCvSharp { // ReSharper disable InconsistentNaming -#pragma warning disable 1591 -#if LANG_JP - /// - /// セミグローバルブロックマッチングアルゴリズムを用てステレオ対応点探索を行うためのクラス - /// -#else /// /// Semi-Global Stereo Matching /// -#endif public class StereoBM : StereoMatcher { private Ptr? ptrObj; diff --git a/src/OpenCvSharp/Modules/calib3d/StereoSGBM.cs b/src/OpenCvSharp/Modules/calib3d/StereoSGBM.cs index 852141966..b7121d7d6 100644 --- a/src/OpenCvSharp/Modules/calib3d/StereoSGBM.cs +++ b/src/OpenCvSharp/Modules/calib3d/StereoSGBM.cs @@ -15,15 +15,9 @@ public enum StereoSGBMMode HH = 1, } -#if LANG_JP - /// - /// セミグローバルブロックマッチングアルゴリズムを用てステレオ対応点探索を行うためのクラス - /// -#else /// /// Semi-Global Stereo Matching /// -#endif public class StereoSGBM : StereoMatcher { private Ptr? ptrObj; diff --git a/src/OpenCvSharp/Modules/core/Delegate/CvErrorCallback.cs b/src/OpenCvSharp/Modules/core/Delegate/CvErrorCallback.cs index b3e418884..20de4b278 100644 --- a/src/OpenCvSharp/Modules/core/Delegate/CvErrorCallback.cs +++ b/src/OpenCvSharp/Modules/core/Delegate/CvErrorCallback.cs @@ -3,17 +3,6 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// エラーハンドラ - /// - /// エラーステータス - /// エラーが発生したOpenCVの関数名 - /// エラーについての追加情報/診断結果 - /// エラーが発生したファイル名 - /// エラーが発生した行番号 - /// -#else /// /// Error Handler /// @@ -23,7 +12,6 @@ namespace OpenCvSharp /// The source file name where error is encountered /// The line number in the source where error is encountered /// Pointer to the user data. Ignored by the standard handlers -#endif [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate int CvErrorCallback( [MarshalAs(UnmanagedType.I4)] ErrorCode status, diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/BorderTypes.cs b/src/OpenCvSharp/Modules/core/Enum/BorderTypes.cs similarity index 67% rename from src/OpenCvSharp/Modules/imgproc/Enum/BorderTypes.cs rename to src/OpenCvSharp/Modules/core/Enum/BorderTypes.cs index f364537da..fd8b36bce 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/BorderTypes.cs +++ b/src/OpenCvSharp/Modules/core/Enum/BorderTypes.cs @@ -1,41 +1,26 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// cvCopyMakeBorderで指定する, 境界線のタイプ - /// -#else /// /// Type of the border to create around the copied source image rectangle /// -#endif + /// + ///https://github.com/opencv/opencv/blob/fc1a15626226609babd128e043cf7c4e32f567ca/modules/core/include/opencv2/core/base.hpp#L268 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum BorderTypes { -#if LANG_JP - /// - /// 境界はこの関数の最後のパラメータとして渡された定数 value で埋められる. - /// `iiiiii|abcdefgh|iiiiiii` with some specified `i` - /// -#else /// /// Border is filled with the fixed value, passed as last parameter of the function. /// `iiiiii|abcdefgh|iiiiiii` with some specified `i` /// -#endif Constant = 0, -#if LANG_JP - /// - /// 画像の最も上/下の行と最も左/右の列(画像領域の一番外側の値)を用いて境界線を生成する. - /// `aaaaaa|abcdefgh|hhhhhhh` - /// -#else /// /// The pixels from the top and bottom rows, the left-most and right-most columns are replicated to fill the border. /// `aaaaaa|abcdefgh|hhhhhhh` /// -#endif Replicate = 1, /// diff --git a/src/OpenCvSharp/Modules/core/Enum/CmpType.cs b/src/OpenCvSharp/Modules/core/Enum/CmpType.cs new file mode 100644 index 000000000..12cd5b411 --- /dev/null +++ b/src/OpenCvSharp/Modules/core/Enum/CmpType.cs @@ -0,0 +1,40 @@ +namespace OpenCvSharp +{ + // ReSharper disable InconsistentNaming + + /// + /// The flag specifying the relation between the elements to be checked + /// + public enum CmpType + { + /// + /// src1(I) "equal to" src2(I) + /// + EQ = 0, + + /// + /// src1(I) "greater than" src2(I) + /// + GT = 1, + + /// + /// src1(I) "greater or equal" src2(I) + /// + GE = 2, + + /// + /// src1(I) "less than" src2(I) + /// + LT = 3, + + /// + /// src1(I) "less or equal" src2(I) + /// + LE = 4, + + /// + /// src1(I) "not equal to" src2(I) + /// + NE = 5, + } +} diff --git a/src/OpenCvSharp/Modules/core/Enum/CmpTypes.cs b/src/OpenCvSharp/Modules/core/Enum/CmpTypes.cs deleted file mode 100644 index c0972b5e6..000000000 --- a/src/OpenCvSharp/Modules/core/Enum/CmpTypes.cs +++ /dev/null @@ -1,87 +0,0 @@ -namespace OpenCvSharp -{ - // ReSharper disable InconsistentNaming - -#if LANG_JP - /// - /// cvCmp, cvCmpS等のメソッドで用いる, CvArrの比較方法 - /// -#else - /// - /// The flag specifying the relation between the elements to be checked - /// -#endif - public enum CmpTypes - { -#if LANG_JP - /// - /// src1(I) と value は等しい - /// -#else - /// - /// src1(I) "equal to" src2(I) - /// -#endif - EQ = 0, - - -#if LANG_JP - /// - /// src1(I) は value より大きい - /// -#else - /// - /// src1(I) "greater than" src2(I) - /// -#endif - GT = 1, - - -#if LANG_JP - /// - /// src1(I) は value より大きいか等しい - /// -#else - /// - /// src1(I) "greater or equal" src2(I) - /// -#endif - GE = 2, - - -#if LANG_JP - /// - /// src1(I) は value より小さい - /// -#else - /// - /// src1(I) "less than" src2(I) - /// -#endif - LT = 3, - - -#if LANG_JP - /// - /// src1(I) は value より小さいか等しい - /// -#else - /// - /// src1(I) "less or equal" src2(I) - /// -#endif - LE = 4, - - -#if LANG_JP - /// - /// src1(I) と value は等しくない - /// -#else - /// - /// src1(I) "not equal to" src2(I) - /// -#endif - NE = 5, - } -} diff --git a/src/OpenCvSharp/Modules/core/Enum/CovarFlags.cs b/src/OpenCvSharp/Modules/core/Enum/CovarFlags.cs index c65e3314b..873d5bcaa 100644 --- a/src/OpenCvSharp/Modules/core/Enum/CovarFlags.cs +++ b/src/OpenCvSharp/Modules/core/Enum/CovarFlags.cs @@ -2,105 +2,50 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// CovarMatrixの処理フラグ - /// -#else /// /// Operation flags for Covariation /// -#endif [Flags] public enum CovarFlags { -#if LANG_JP - /// - /// scale * [vects[0]-avg,vects[1]-avg,...]^T * [vects[0]-avg,vects[1]-avg,...] - /// すなわち,共変動行列はcount×countである. そのような一般的でない共変動行列は, - /// 非常に大きなベクトル集合に対する高速な主成分分析のために使用される(例えば,顔認識のための固有顔). - /// この「スクランブルされた」行列の固有値は,真共変動行列の固有値と一致し, - /// そして「真の」固有ベクトルは「スクランブルされた」共変動行列の固有ベクトルから容易に計算できる. - /// -#else /// /// scale * [vects[0]-avg,vects[1]-avg,...]^T * [vects[0]-avg,vects[1]-avg,...] /// that is, the covariation matrix is count×count. Such an unusual covariation matrix is used for fast PCA of a set of very large vectors /// (see, for example, Eigen Faces technique for face recognition). Eigenvalues of this "scrambled" matrix will match to the eigenvalues of /// the true covariation matrix and the "true" eigenvectors can be easily calculated from the eigenvectors of the "scrambled" covariation matrix. /// -#endif Scrambled = 0, - -#if LANG_JP - /// - /// scale * [vects[0]-avg,vects[1]-avg,...]*[vects[0]-avg,vects[1]-avg,...]^T - /// つまり,cov_matはすべての入力ベクトルの要素の合計と同じサイズの一般的な共変動行列となる. - /// CV_COVAR_SCRAMBLEDとCV_COVAR_NORMALのどちらか一つは必ず指定されなくてはならない. - /// -#else /// /// scale * [vects[0]-avg,vects[1]-avg,...]*[vects[0]-avg,vects[1]-avg,...]^T /// that is, cov_mat will be a usual covariation matrix with the same linear size as the total number of elements in every input vector. /// One and only one of CV_COVAR_SCRAMBLED and CV_COVAR_NORMAL must be specified /// -#endif Normal = 1, - -#if LANG_JP - /// - /// このフラグが指定された場合,関数は入力ベクトルから平均を計算せず,引数で指定された平均ベクトルを使用する. - /// 平均が何らかの方法で既に計算されている場合,または共変動行列が部分的に計算されている場合 (この場合,avgは入力ベクトルの一部の平均ではなく,全ての平均ベクトルである)に有用である. - /// -#else /// /// If the flag is specified, the function does not calculate avg from the input vectors, /// but, instead, uses the passed avg vector. This is useful if avg has been already calculated somehow, /// or if the covariation matrix is calculated by parts - in this case, avg is not a mean vector of the input sub-set of vectors, /// but rather the mean vector of the whole set. /// -#endif UseAvg = 2, - -#if LANG_JP - /// - /// このフラグが指定された場合, 共変動行列は入力ベクトルの数によってスケーリングされる. - /// -#else /// /// If the flag is specified, the covariation matrix is scaled by the number of input vectors. /// -#endif Scale = 4, - -#if LANG_JP - /// - /// 全ての入力ベクトルは単一の行列(vects[0])の行として保存されることを意味する. - /// そしてavgは適切な大きさの1行のベクトルでなければならない. - /// -#else /// /// Means that all the input vectors are stored as rows of a single matrix, vects[0].count is ignored in this case, /// and avg should be a single-row vector of an appropriate size. /// -#endif Rows = 8, - -#if LANG_JP - /// - /// 全ての入力ベクトルは単一の行列(vects[0])の列として保存されることを意味する.そしてavgは適切な大きさの1列のベクトルでなければならない. - /// -#else /// /// Means that all the input vectors are stored as columns of a single matrix, vects[0].count is ignored in this case, /// and avg should be a single-column vector of an appropriate size. /// -#endif Cols = 16, } } diff --git a/src/OpenCvSharp/Modules/core/Enum/CriteriaType.cs b/src/OpenCvSharp/Modules/core/Enum/CriteriaTypes.cs similarity index 56% rename from src/OpenCvSharp/Modules/core/Enum/CriteriaType.cs rename to src/OpenCvSharp/Modules/core/Enum/CriteriaTypes.cs index f570c4889..48d66c597 100644 --- a/src/OpenCvSharp/Modules/core/Enum/CriteriaType.cs +++ b/src/OpenCvSharp/Modules/core/Enum/CriteriaTypes.cs @@ -2,51 +2,25 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// 終了条件の種類 - /// -#else /// /// Type of termination criteria /// -#endif [Flags] - public enum CriteriaType + public enum CriteriaTypes { -#if LANG_JP - /// - /// 繰り返し回数による条件 - /// -#else /// /// the maximum number of iterations or elements to compute /// -#endif Count = 1, - -#if LANG_JP - /// - /// 繰り返し回数による条件 - /// -#else /// /// the maximum number of iterations or elements to compute /// -#endif MaxIter = Count, - -#if LANG_JP - /// - /// 目標精度(ε)による条件 - /// -#else /// /// the desired accuracy or change in parameters at which the iterative algorithm stops /// -#endif Eps = 2, } } \ No newline at end of file diff --git a/src/OpenCvSharp/Modules/core/Enum/DctFlags.cs b/src/OpenCvSharp/Modules/core/Enum/DctFlags.cs index 67c4edb86..ba5a88e4d 100644 --- a/src/OpenCvSharp/Modules/core/Enum/DctFlags.cs +++ b/src/OpenCvSharp/Modules/core/Enum/DctFlags.cs @@ -2,17 +2,10 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cv::dct の変換フラグ - /// -#else /// /// Transformation flags for cv::dct /// -#endif [Flags] -// ReSharper disable once InconsistentNaming public enum DctFlags { /// @@ -20,36 +13,18 @@ public enum DctFlags /// None = 0, -#if LANG_JP - /// - /// 1次元または2次元の逆変換を行う.結果のスケーリングは行わない. - /// Forward と Inverse は,もちろん同時には指定できない. - /// -#else /// /// Do inverse 1D or 2D transform. /// (Forward and Inverse are mutually exclusive, of course.) /// -#endif Inverse = 1, - -#if LANG_JP - /// - /// 入力配列のそれぞれの行に対して独立に,順変換あるいは逆変換を行う. - /// このフラグは複数のベクトルの同時変換を許可し, - /// オーバーヘッド(一つの計算の何倍も大きくなることもある)を減らすためや, - /// 3次元以上の高次元に対して変換を行うために使用される. - /// [CV_DXT_ROWS] - /// -#else /// /// Do forward or inverse transform of every individual row of the input matrix. /// This flag allows user to transform multiple vectors simultaneously and can be used to decrease the overhead /// (which is sometimes several times larger than the processing itself), to do 3D and higher-dimensional transforms etc. /// [CV_DXT_ROWS] /// -#endif Rows = 4, } } diff --git a/src/OpenCvSharp/Modules/core/Enum/DecompTypes.cs b/src/OpenCvSharp/Modules/core/Enum/DecompTypes.cs index 9b0a1911c..81f524eb7 100644 --- a/src/OpenCvSharp/Modules/core/Enum/DecompTypes.cs +++ b/src/OpenCvSharp/Modules/core/Enum/DecompTypes.cs @@ -2,41 +2,20 @@ { // ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// 逆行列を求める手法 - /// -#else /// /// Inversion methods /// -#endif public enum DecompTypes { -#if LANG_JP - /// - /// 最適なピボット選択によるガウスの消去法 - /// [CV_LU] - /// -#else /// /// Gaussian elimination with the optimal pivot element chosen. /// -#endif - LU = 0, -#if LANG_JP - /// - /// 特異値分解 - /// [CV_SVD] - /// -#else /// /// singular value decomposition (SVD) method; /// the system can be over-defined and/or the matrix src1 can be singular /// -#endif SVD = 1, /// diff --git a/src/OpenCvSharp/Modules/core/Enum/DftFlags.cs b/src/OpenCvSharp/Modules/core/Enum/DftFlags.cs index cd99efd9f..2663a98e6 100644 --- a/src/OpenCvSharp/Modules/core/Enum/DftFlags.cs +++ b/src/OpenCvSharp/Modules/core/Enum/DftFlags.cs @@ -2,15 +2,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cvDFTの変換フラグ - /// -#else /// /// Transformation flags for cvDFT /// -#endif [Flags] public enum DftFlags { @@ -19,47 +13,22 @@ public enum DftFlags /// None = 0, -#if LANG_JP - /// - /// 1次元または2次元の逆変換を行う.結果のスケーリングは行わない. - /// Forward と Inverse は,もちろん同時には指定できない. - /// -#else /// /// Do inverse 1D or 2D transform. The result is not scaled. /// (Forward and Inverse are mutually exclusive, of course.) /// -#endif Inverse = 1, - -#if LANG_JP - /// - /// 結果を配列要素数で割り,スケーリングする.通常は Inverse と同時に用いる. - /// ショートカットとして InvScale を用いても良い. - /// [CV_DXT_SCALE] - /// -#else /// /// Scale the result: divide it by the number of array elements. Usually, it is combined with Inverse. /// -#endif Scale = 2, -#if LANG_JP - /// - /// 入力配列のそれぞれの行に対して独立に,順変換あるいは逆変換を行う. - /// このフラグは複数のベクトルの同時変換を許可し, - /// オーバーヘッド(一つの計算の何倍も大きくなることもある)を減らすためや, - /// 3次元以上の高次元に対して変換を行うために使用される. - /// -#else /// /// Do forward or inverse transform of every individual row of the input matrix. /// This flag allows user to transform multiple vectors simultaneously and can be used to decrease the overhead /// (which is sometimes several times larger than the processing itself), to do 3D and higher-dimensional transforms etc. /// -#endif Rows = 4, /// diff --git a/src/OpenCvSharp/Modules/core/Enum/DistributionType.cs b/src/OpenCvSharp/Modules/core/Enum/DistributionType.cs index 3cf853e66..4d5b7cbc5 100644 --- a/src/OpenCvSharp/Modules/core/Enum/DistributionType.cs +++ b/src/OpenCvSharp/Modules/core/Enum/DistributionType.cs @@ -1,37 +1,18 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cvRandArrメソッド等で用いる, 分布のタイプ - /// -#else /// /// Distribution type for cvRandArr, etc. /// -#endif public enum DistributionType { -#if LANG_JP - /// - /// 一様分布 - /// -#else /// /// Uniform distribution /// -#endif Uniform = 0, - -#if LANG_JP - /// - /// 正規分布(ガウス分布) - /// -#else /// /// Normal or Gaussian distribution /// -#endif Normal = 1, } } diff --git a/src/OpenCvSharp/Modules/core/Enum/GemmFlags.cs b/src/OpenCvSharp/Modules/core/Enum/GemmFlags.cs index c56f57517..89684e18e 100644 --- a/src/OpenCvSharp/Modules/core/Enum/GemmFlags.cs +++ b/src/OpenCvSharp/Modules/core/Enum/GemmFlags.cs @@ -4,15 +4,9 @@ namespace OpenCvSharp { // ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// cv::GEMMメソッドの操作フラグ - /// -#else /// /// The operation flags for cv::GEMM /// -#endif [Flags] public enum GemmFlags { @@ -21,40 +15,19 @@ public enum GemmFlags /// None = 0, -#if LANG_JP - /// - /// src1を転置 - /// -#else /// /// Transpose src1 /// -#endif - A_T = 1, - -#if LANG_JP - /// - /// src2を転置 - /// -#else /// /// Transpose src2 /// -#endif B_T = 2, - -#if LANG_JP - /// - /// src3を転置 - /// -#else /// /// Transpose src3 /// -#endif C_T = 4, } } diff --git a/src/OpenCvSharp/Modules/core/Enum/HersheyFonts.cs b/src/OpenCvSharp/Modules/core/Enum/HersheyFonts.cs index a8f57034d..f2c35750e 100644 --- a/src/OpenCvSharp/Modules/core/Enum/HersheyFonts.cs +++ b/src/OpenCvSharp/Modules/core/Enum/HersheyFonts.cs @@ -2,17 +2,10 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// フォント名の識別子.現在はHershey fontsの一部のみサポートされている. - /// フォント名のフラグにはイタリックフラグ(Italic)を合成することができる. - /// -#else /// /// Font name identifier. /// Only a subset of Hershey fonts (http://sources.isc.org/utils/misc/hershey-font.txt) are supported now. /// -#endif [Flags] public enum HersheyFonts { diff --git a/src/OpenCvSharp/Modules/core/Enum/KMeansFlags.cs b/src/OpenCvSharp/Modules/core/Enum/KMeansFlags.cs index e68050e4f..485c158ab 100644 --- a/src/OpenCvSharp/Modules/core/Enum/KMeansFlags.cs +++ b/src/OpenCvSharp/Modules/core/Enum/KMeansFlags.cs @@ -2,15 +2,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cv::kmeans の処理フラグ - /// -#else /// /// Miscellaneous flags for cv::kmeans /// -#endif [Flags] public enum KMeansFlags { diff --git a/src/OpenCvSharp/Modules/core/Enum/MatDiagType.cs b/src/OpenCvSharp/Modules/core/Enum/MatDiagType.cs index 1bc937b5c..5e8965d24 100644 --- a/src/OpenCvSharp/Modules/core/Enum/MatDiagType.cs +++ b/src/OpenCvSharp/Modules/core/Enum/MatDiagType.cs @@ -1,14 +1,8 @@ namespace OpenCvSharp { -#if LANG_JP /// /// diagonal type /// -#else - /// - /// diagonal type - /// -#endif public enum MatDiagType { /// @@ -30,5 +24,3 @@ public enum MatDiagType Lower = +1, } } - - diff --git a/src/OpenCvSharp/Modules/core/Enum/NormTypes.cs b/src/OpenCvSharp/Modules/core/Enum/NormTypes.cs index 92cc03e38..f9437d63f 100644 --- a/src/OpenCvSharp/Modules/core/Enum/NormTypes.cs +++ b/src/OpenCvSharp/Modules/core/Enum/NormTypes.cs @@ -4,44 +4,25 @@ namespace OpenCvSharp { // ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// 正規化のタイプ - /// -#else /// /// Type of norm /// -#endif [Flags] public enum NormTypes { /// /// /// - INF = 1, -#if LANG_JP - /// - /// 配列のL1-norm(絶対値の合計)を正規化 - /// -#else /// /// The L1-norm (sum of absolute values) of the array is normalized. /// -#endif L1 = 2, -#if LANG_JP - /// - /// 配列のL2-norm(ユークリッド距離)を正規化 - /// -#else /// /// The (Euclidean) L2-norm of the array is normalized. /// -#endif L2 = 4, /// @@ -64,15 +45,9 @@ public enum NormTypes /// Relative = 8, -#if LANG_JP - /// - /// 配列の値が指定の範囲に収まるようにスケーリングとシフトを行う - /// -#else /// /// The array values are scaled and shifted to the specified range. /// -#endif MinMax = 32, } } diff --git a/src/OpenCvSharp/Modules/core/Enum/ReduceDimension.cs b/src/OpenCvSharp/Modules/core/Enum/ReduceDimension.cs index 8f51c73d6..3fd4ebaf7 100644 --- a/src/OpenCvSharp/Modules/core/Enum/ReduceDimension.cs +++ b/src/OpenCvSharp/Modules/core/Enum/ReduceDimension.cs @@ -1,54 +1,27 @@  namespace OpenCvSharp { -#if LANG_JP - /// - /// cvReduceで、配列をどのように縮小するかを示すインデックス - /// -#else /// /// The dimension index along which the matrix is reduce. /// -#endif public enum ReduceDimension { -#if LANG_JP - /// - /// 行列を1行ベクトルに縮小する - /// [= 0] - /// -#else /// /// The matrix is reduced to a single row. /// [= 0] /// -#endif Row = 0, -#if LANG_JP - /// - /// 行列を1列ベクトルに縮小する - /// [= 1] - /// -#else /// /// The matrix is reduced to a single column. /// [= 1] /// -#endif Column = 1, -#if LANG_JP - /// - /// 出力行列のサイズから次元を解析し,自動的に選択する - /// [= -1] - /// -#else /// /// The dimension is chosen automatically by analysing the dst size. /// [= -1] /// -#endif Auto = -1 } } diff --git a/src/OpenCvSharp/Modules/core/Enum/ReduceTypes.cs b/src/OpenCvSharp/Modules/core/Enum/ReduceTypes.cs index 7ab8fbfdb..95c54afe6 100644 --- a/src/OpenCvSharp/Modules/core/Enum/ReduceTypes.cs +++ b/src/OpenCvSharp/Modules/core/Enum/ReduceTypes.cs @@ -1,62 +1,34 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// cvReduceで用いる縮小処理の種類 - /// -#else /// /// The reduction operations for cvReduce /// -#endif + /// + ///https://github.com/opencv/opencv/blob/37c12db3668a1fbbfdb286be59f662c67cfbfea1/modules/core/include/opencv2/core.hpp#L231 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum ReduceTypes { -#if LANG_JP - /// - /// 出力は各行(または各列)の総和 - /// -#else /// /// The output is the sum of all the matrix rows/columns. /// -#endif Sum = 0, - -#if LANG_JP - /// - /// 出力は各行(または各列)の平均ベクトル - /// -#else /// /// The output is the mean vector of all the matrix rows/columns. /// -#endif Avg = 1, - -#if LANG_JP - /// - /// 出力は各行(または各列)における最大値 - /// -#else /// /// The output is the maximum (column/row-wise) of all the matrix rows/columns. /// -#endif Max = 2, - -#if LANG_JP - /// - /// 出力は各行(または各列)における最小値 - /// -#else /// /// The output is the minimum (column/row-wise) of all the matrix rows/columns. /// -#endif Min = 3, } } diff --git a/src/OpenCvSharp/Modules/core/Enum/SortFlags.cs b/src/OpenCvSharp/Modules/core/Enum/SortFlags.cs index eca170300..554fdce08 100644 --- a/src/OpenCvSharp/Modules/core/Enum/SortFlags.cs +++ b/src/OpenCvSharp/Modules/core/Enum/SortFlags.cs @@ -2,15 +2,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cv::sortで用いる、配列の並び順指定 - /// -#else /// /// Signals an error and raises the exception. /// -#endif [Flags] public enum SortFlags { diff --git a/src/OpenCvSharp/Modules/core/FileStorage.cs b/src/OpenCvSharp/Modules/core/FileStorage.cs index 05352af4c..a02a64d06 100644 --- a/src/OpenCvSharp/Modules/core/FileStorage.cs +++ b/src/OpenCvSharp/Modules/core/FileStorage.cs @@ -37,7 +37,7 @@ public FileStorage() /// /// Encoding of the file. Note that UTF-16 XML encoding is not supported /// currently and you should use 8-bit encoding instead of it. - public FileStorage(string source, Mode flags, string? encoding = null) + public FileStorage(string source, Modes flags, string? encoding = null) { if (source == null) throw new ArgumentNullException(nameof(source)); @@ -130,7 +130,7 @@ public States State /// Encoding of the file. Note that UTF-16 XML encoding is not supported /// currently and you should use 8-bit encoding instead of it. /// - public virtual bool Open(string fileName, Mode flags, string? encoding = null) + public virtual bool Open(string fileName, Modes flags, string? encoding = null) { ThrowIfDisposed(); if (fileName == null) @@ -1171,49 +1171,25 @@ public enum States InsideMap = 4 } -#if LANG_JP - /// - /// FileStorageのモード - /// -#else /// /// File storage mode /// -#endif [Flags] - public enum Mode + public enum Modes { -#if LANG_JP - /// - /// データ読み込みのためのファイルオープン - /// -#else /// /// The storage is open for reading /// -#endif Read = 0, -#if LANG_JP - /// - /// データ書き込みのためのファイルオープン - /// -#else /// /// The storage is open for writing /// -#endif Write = 1, -#if LANG_JP - /// - /// データ追加書き込みのためのファイルオープン - /// -#else /// /// The storage is open for appending /// -#endif Append = 2, /// diff --git a/src/OpenCvSharp/Modules/core/Mat/Mat.cs b/src/OpenCvSharp/Modules/core/Mat/Mat.cs index 2de8fd219..cc705329f 100644 --- a/src/OpenCvSharp/Modules/core/Mat/Mat.cs +++ b/src/OpenCvSharp/Modules/core/Mat/Mat.cs @@ -80,17 +80,10 @@ public partial class Mat : DisposableCvObject [typeof(DMatch)] = MatType.CV_32FC4, }; -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else /// /// Creates from native cv::Mat* pointer /// /// -#endif public Mat(IntPtr ptr) { if (ptr == IntPtr.Zero) @@ -98,15 +91,9 @@ public Mat(IntPtr ptr) this.ptr = ptr; } -#if LANG_JP - /// - /// 空の行列として初期化 - /// -#else /// /// Creates empty Mat /// -#endif public Mat() { NativeMethods.HandleException( @@ -129,19 +116,11 @@ protected Mat(Mat m) throw new OpenCvSharpException("imread failed."); } -#if LANG_JP - /// - /// 画像ファイルから読み込んで初期化 (cv::imread) - /// - /// 読み込まれる画像ファイル名 - /// 画像読み込みフラグ. -#else /// /// Loads an image from a file. (cv::imread) /// /// Name of file to be loaded. /// Specifies color type of the loaded image -#endif public Mat(string fileName, ImreadModes flags = ImreadModes.Color) { if (string.IsNullOrEmpty(fileName)) @@ -151,15 +130,6 @@ public Mat(string fileName, ImreadModes flags = ImreadModes.Color) NativeMethods.imgcodecs_imread(fileName, (int) flags, out ptr)); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else /// /// constructs 2D matrix of the specified size and type /// @@ -167,21 +137,12 @@ public Mat(string fileName, ImreadModes flags = ImreadModes.Color) /// Number of columns in a 2D array. /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif public Mat(int rows, int cols, MatType type) { NativeMethods.HandleException( NativeMethods.core_Mat_new2(rows, cols, type, out ptr)); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else /// /// constructs 2D matrix of the specified size and type /// @@ -189,24 +150,12 @@ public Mat(int rows, int cols, MatType type) /// the number of rows and the number of columns go in the reverse order. /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType.CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif public Mat(Size size, MatType type) { NativeMethods.HandleException( NativeMethods.core_Mat_new2(size.Height, size.Width, type, out ptr)); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constructs 2D matrix and fills it with the specified Scalar value. /// @@ -216,23 +165,12 @@ public Mat(Size size, MatType type) /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public Mat(int rows, int cols, MatType type, Scalar s) { NativeMethods.HandleException( NativeMethods.core_Mat_new3(rows, cols, type, s, out ptr)); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constructs 2D matrix and fills it with the specified Scalar value. /// @@ -242,27 +180,12 @@ public Mat(int rows, int cols, MatType type, Scalar s) /// or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public Mat(Size size, MatType type, Scalar s) { NativeMethods.HandleException( NativeMethods.core_Mat_new3(size.Height, size.Width, type, s, out ptr)); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -274,7 +197,6 @@ public Mat(Size size, MatType type, Scalar s) /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. /// Use Range.All to take all the rows. /// Range of the m columns to take. Use Range.All to take all the columns. -#endif public Mat(Mat m, Range rowRange, Range? colRange = null) { if (m == null) @@ -288,19 +210,6 @@ public Mat(Mat m, Range rowRange, Range? colRange = null) GC.KeepAlive(m); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -310,7 +219,6 @@ public Mat(Mat m, Range rowRange, Range? colRange = null) /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . /// If you want to have an independent copy of the sub-array, use Mat.Clone() . /// Array of selected ranges of m along each dimensionality. -#endif public Mat(Mat m, params Range[] ranges) { if (m == null) @@ -326,19 +234,6 @@ public Mat(Mat m, params Range[] ranges) GC.KeepAlive(m); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -348,7 +243,6 @@ public Mat(Mat m, params Range[] ranges) /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . /// If you want to have an independent copy of the sub-array, use Mat.Clone() . /// Region of interest. -#endif public Mat(Mat m, Rect roi) { if (m == null) @@ -360,24 +254,6 @@ public Mat(Mat m, Rect roi) GC.KeepAlive(m); } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -391,31 +267,12 @@ public Mat(Mat m, Rect roi) /// The external data is not automatically de-allocated, so you should take care of it. /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif public Mat(int rows, int cols, MatType type, IntPtr data, long step = 0) { NativeMethods.HandleException( NativeMethods.core_Mat_new8(rows, cols, type, data, new IntPtr(step), out ptr)); } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -429,7 +286,6 @@ public Mat(int rows, int cols, MatType type, IntPtr data, long step = 0) /// The external data is not automatically de-allocated, so you should take care of it. /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif public Mat(int rows, int cols, MatType type, Array data, long step = 0) { var handle = AllocGCHandle(data); @@ -438,22 +294,6 @@ public Mat(int rows, int cols, MatType type, Array data, long step = 0) handle.AddrOfPinnedObject(), new IntPtr(step), out ptr)); } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -466,7 +306,6 @@ public Mat(int rows, int cols, MatType type, Array data, long step = 0) /// The external data is not automatically de-allocated, so you should take care of it. /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). /// If not specified, the matrix is assumed to be continuous. -#endif public Mat(IEnumerable sizes, MatType type, IntPtr data, IEnumerable? steps = null) { if (sizes == null) @@ -487,22 +326,6 @@ public Mat(IEnumerable sizes, MatType type, IntPtr data, IEnumerable? } } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -515,7 +338,6 @@ public Mat(IEnumerable sizes, MatType type, IntPtr data, IEnumerable? /// The external data is not automatically de-allocated, so you should take care of it. /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). /// If not specified, the matrix is assumed to be continuous. -#endif public Mat(IEnumerable sizes, MatType type, Array data, IEnumerable? steps = null) { if (sizes == null) @@ -540,21 +362,12 @@ public Mat(IEnumerable sizes, MatType type, Array data, IEnumerable? } } -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else /// /// constructs n-dimensional matrix /// /// Array of integers specifying an n-dimensional array shape. /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif public Mat(IEnumerable sizes, MatType type) { if (sizes == null) @@ -565,16 +378,6 @@ public Mat(IEnumerable sizes, MatType type) NativeMethods.core_Mat_new10(sizesArray.Length, sizesArray, type, out ptr)); } -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constructs n-dimensional matrix /// @@ -583,7 +386,6 @@ public Mat(IEnumerable sizes, MatType type) /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public Mat(IEnumerable sizes, MatType type, Scalar s) { if (sizes == null) @@ -593,15 +395,9 @@ public Mat(IEnumerable sizes, MatType type, Scalar s) NativeMethods.core_Mat_new11(sizesArray.Length, sizesArray, type, s, out ptr)); } -#if LANG_JP -/// -/// リソースの解放 -/// -#else /// /// Releases the resources /// -#endif public void Release() { Dispose(); @@ -621,21 +417,12 @@ protected override void DisposeUnmanaged() #region Static Initializers -#if LANG_JP - /// - /// System.IO.StreamのインスタンスからMatを生成する - /// - /// - /// - /// -#else /// /// Creates the Mat instance from System.IO.Stream /// /// /// /// -#endif public static Mat FromStream(Stream stream, ImreadModes mode) { if (stream == null) @@ -649,21 +436,12 @@ public static Mat FromStream(Stream stream, ImreadModes mode) return FromImageData(memoryStream.ToArray(), mode); } -#if LANG_JP - /// - /// 画像データ(JPEG等の画像をメモリに展開したもの)からMatを生成する (cv::imdecode) - /// - /// - /// - /// -#else /// /// Creates the Mat instance from image data (using cv::decode) /// /// /// /// -#endif public static Mat ImDecode(byte[] imageBytes, ImreadModes mode = ImreadModes.Color) { if (imageBytes == null) @@ -682,21 +460,12 @@ public static Mat ImDecode(ReadOnlySpan span, ImreadModes mode = ImreadMod return Cv2.ImDecode(span, mode); } -#if LANG_JP - /// - /// 画像データ(JPEG等の画像をメモリに展開したもの)からMatを生成する (cv::imdecode) - /// - /// - /// - /// -#else /// /// Creates the Mat instance from image data (using cv::decode) /// /// /// /// -#endif public static Mat FromImageData(byte[] imageBytes, ImreadModes mode = ImreadModes.Color) { return ImDecode(imageBytes, mode); @@ -850,17 +619,10 @@ public static MatExpr Eye(int rows, int cols, MatType type) #region FromArray -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else /// /// Initializes as N x 1 matrix and copies array data to this /// /// Source array data to be copied to this -#endif public static Mat FromArray(params TElem[] arr) where TElem : unmanaged { @@ -876,17 +638,10 @@ public static Mat FromArray(params TElem[] arr) return mat; } -#if LANG_JP - /// - /// M x N の行列として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else /// /// Initializes as M x N matrix and copies array data to this /// /// Source array data to be copied to this -#endif public static Mat FromArray(TElem[,] arr) where TElem : unmanaged { @@ -903,17 +658,10 @@ public static Mat FromArray(TElem[,] arr) return mat; } -#if LANG_JP - /// - /// N x 1 の行列(ベクトル)として初期化し、指定した配列からデータをコピーする - /// - /// この行列にコピーされるデータ -#else /// /// Initializes as N x 1 matrix and copies array data to this /// /// Source array data to be copied to this -#endif public static Mat FromArray(IEnumerable enumerable) where TElem : unmanaged { @@ -3200,18 +2948,10 @@ public string Dump(FormatType format = FormatType.Default) #region EmptyClone -#if LANG_JP - /// - /// このMatと同じサイズ・ビット深度・チャネル数を持つ - /// Matオブジェクトを新たに作成し、返す - /// - /// コピーされた画像 -#else /// /// Makes a Mat that have the same size, depth and channels as this image /// /// -#endif public Mat EmptyClone() { ThrowIfDisposed(); diff --git a/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs b/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs index bc3ece03e..cefd9aa2a 100644 --- a/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs +++ b/src/OpenCvSharp/Modules/core/Mat/MatOfT.cs @@ -21,96 +21,52 @@ private static MatType GetMatType() throw new NotSupportedException($"Type parameter {type} is not supported by Mat"); } -#if LANG_JP /// /// Creates empty Mat /// -#else - /// - /// Creates empty Mat - /// -#endif public Mat() : this(0, 0) { } -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else /// /// Creates from native cv::Mat* pointer /// /// -#endif public Mat(IntPtr ptr) : base(ptr) { } -#if LANG_JP - /// - /// Matオブジェクトから初期化 - /// - /// Matオブジェクト -#else /// /// Initializes by Mat object /// /// Managed Mat object -#endif public Mat(Mat mat) : base(mat) { } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. -#else /// /// constructs 2D matrix of the specified size and type /// /// Number of rows in a 2D array. /// Number of columns in a 2D array. -#endif public Mat(int rows, int cols) : base(rows, cols, GetMatType()) { } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. -#else /// /// constructs 2D matrix of the specified size and type /// /// 2D array size: Size(cols, rows) . In the Size() constructor, /// the number of rows and the number of columns go in the reverse order. -#endif public Mat(Size size) : base(size, GetMatType()) { } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constructs 2D matrix and fills it with the specified Scalar value. /// @@ -118,20 +74,11 @@ public Mat(Size size) /// Number of columns in a 2D array. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public Mat(int rows, int cols, Scalar s) : base(rows, cols, GetMatType(), s) { } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constructs 2D matrix and fills it with the specified Scalar value. /// @@ -139,27 +86,11 @@ public Mat(int rows, int cols, Scalar s) /// the number of rows and the number of columns go in the reverse order. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public Mat(Size size, Scalar s) : base(size, GetMatType(), s) { } - -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -171,25 +102,11 @@ public Mat(Size size, Scalar s) /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. /// Use Range.All to take all the rows. /// Range of the m columns to take. Use Range.All to take all the columns. -#endif public Mat(Mat m, Range rowRange, Range? colRange = null) : base(m, rowRange, colRange) { } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -199,25 +116,11 @@ public Mat(Mat m, Range rowRange, Range? colRange = null) /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . /// If you want to have an independent copy of the sub-array, use Mat.Clone() . /// Array of selected ranges of m along each dimensionality. -#endif protected Mat(Mat m, params Range[] ranges) : base(m, ranges) { } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -227,28 +130,11 @@ protected Mat(Mat m, params Range[] ranges) /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . /// If you want to have an independent copy of the sub-array, use Mat.Clone() . /// Region of interest. -#endif public Mat(Mat m, Rect roi) : base(m, roi) { } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -260,28 +146,11 @@ public Mat(Mat m, Rect roi) /// The external data is not automatically de-allocated, so you should take care of it. /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif protected Mat(int rows, int cols, IntPtr data, long step = 0) : base(rows, cols, GetMatType(), data, step) { } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -293,26 +162,11 @@ protected Mat(int rows, int cols, IntPtr data, long step = 0) /// The external data is not automatically de-allocated, so you should take care of it. /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif public Mat(int rows, int cols, Array data, long step = 0) : base(rows, cols, GetMatType(), data, step) { } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// Array of integers specifying an n-dimensional array shape. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -323,26 +177,11 @@ public Mat(int rows, int cols, Array data, long step = 0) /// The external data is not automatically de-allocated, so you should take care of it. /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). /// If not specified, the matrix is assumed to be continuous. -#endif public Mat(IEnumerable sizes, IntPtr data, IEnumerable? steps = null) : base(sizes, GetMatType(), data, steps) { } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 多次元配列における ndims-1 個のステップを表す配列 - /// (最後のステップは常に要素サイズになります).これが指定されないと, - /// 行列は連続したものとみなされます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -353,43 +192,26 @@ public Mat(IEnumerable sizes, IntPtr data, IEnumerable? steps = null) /// The external data is not automatically de-allocated, so you should take care of it. /// Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). /// If not specified, the matrix is assumed to be continuous. -#endif public Mat(IEnumerable sizes, Array data, IEnumerable? steps = null) : base(sizes, GetMatType(), data, steps) { } -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. -#else /// /// constructs n-dimensional matrix /// /// Array of integers specifying an n-dimensional array shape. -#endif public Mat(IEnumerable sizes) : base(sizes, GetMatType()) { } -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constructs n-dimensional matrix /// /// Array of integers specifying an n-dimensional array shape. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public Mat(IEnumerable sizes, Scalar s) : base(sizes, GetMatType(), s) { diff --git a/src/OpenCvSharp/Modules/core/Mat/Mat_CvMethods.cs b/src/OpenCvSharp/Modules/core/Mat/Mat_CvMethods.cs index 29476fa0f..d967c50f4 100644 --- a/src/OpenCvSharp/Modules/core/Mat/Mat_CvMethods.cs +++ b/src/OpenCvSharp/Modules/core/Mat/Mat_CvMethods.cs @@ -15,21 +15,12 @@ public MatExpr Abs() return Cv2.Abs(this); } -#if LANG_JP - /// - /// スケーリング後,絶対値を計算し,結果を結果を 8 ビットに変換します. - /// - /// オプションのスケールファクタ. [既定値は1] - /// スケーリングされた値に加えられるオプション値. [既定値は0] - /// -#else /// /// Scales, computes absolute values and converts the result to 8-bit. /// /// The optional scale factor. [By default this is 1] /// The optional delta added to the scaled values. [By default this is 0] /// -#endif public Mat ConvertScaleAbs(double alpha = 1, double beta = 0) { var dst = new Mat(); @@ -647,19 +638,6 @@ public void RandShuffle(double iterFactor, ref RNG rng) #region Line -#if LANG_JP - /// - /// 2点を結ぶ線分を画像上に描画する. - /// - /// 線分の1番目の端点x - /// 線分の1番目の端点y - /// 線分の2番目の端点x - /// 線分の2番目の端点y - /// 線分の色 - /// 線分の太さ. [既定値は1] - /// 線分の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws a line segment connecting two points /// @@ -671,24 +649,12 @@ public void RandShuffle(double iterFactor, ref RNG rng) /// Line thickness. [By default this is 1] /// Type of the line. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public void Line(int pt1X, int pt1Y, int pt2X, int pt2Y, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) { Cv2.Line(this, pt1X, pt1Y, pt2X, pt2Y, color, thickness, lineType, shift); } -#if LANG_JP - /// - /// 2点を結ぶ線分を画像上に描画する. - /// - /// 線分の1番目の端点 - /// 線分の2番目の端点 - /// 線分の色 - /// 線分の太さ. [既定値は1] - /// 線分の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws a line segment connecting two points /// @@ -698,7 +664,6 @@ public void Line(int pt1X, int pt1Y, int pt2X, int pt2Y, Scalar color, /// Line thickness. [By default this is 1] /// Type of the line. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public void Line( Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) @@ -710,17 +675,6 @@ public void Line( #region Rectangle -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 矩形の一つの頂点 - /// 矩形の反対側の頂点 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws simple, thick or filled rectangle /// @@ -730,7 +684,6 @@ public void Line( /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] /// Type of the line, see cvLine description. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public void Rectangle( Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) @@ -738,16 +691,6 @@ public void Rectangle( Cv2.Rectangle(this, pt1, pt2, color, thickness, lineType, shift); } -#if LANG_JP - /// - /// 枠のみ,もしくは塗りつぶされた矩形を描画する - /// - /// 矩形 - /// 線の色(RGB),もしくは輝度(グレースケール画像). - /// 矩形を描く線の太さ.負の値を指定した場合は塗りつぶされる. [既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 座標の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws simple, thick or filled rectangle /// @@ -756,7 +699,6 @@ public void Rectangle( /// Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1] /// Type of the line, see cvLine description. [By default this is LineType.Link8] /// Number of fractional bits in the point coordinates. [By default this is 0] -#endif public void Rectangle( Rect rect, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) @@ -768,18 +710,6 @@ public void Rectangle( #region Circle -#if LANG_JP - /// - /// 円を描画する - /// - /// 円の中心のx座標 - /// 円の中心のy座標 - /// 円の半径 - /// 円の色 - /// 線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 中心座標と半径の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws a circle /// @@ -790,24 +720,12 @@ public void Rectangle( /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] /// Type of the circle boundary. [By default this is LineType.Link8] /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] -#endif public void Circle(int centerX, int centerY, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) { Cv2.Circle(this, centerX, centerY, radius, color, thickness, lineType, shift); } -#if LANG_JP - /// - /// 円を描画する - /// - /// 円の中心 - /// 円の半径 - /// 円の色 - /// 線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1] - /// 線の種類. [既定値はLineType.Link8] - /// 中心座標と半径の小数点以下の桁を表すビット数. [既定値は0] -#else /// /// Draws a circle /// @@ -817,7 +735,6 @@ public void Circle(int centerX, int centerY, int radius, Scalar color, /// Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1] /// Type of the circle boundary. [By default this is LineType.Link8] /// Number of fractional bits in the center coordinates and radius value. [By default this is 0] -#endif public void Circle(Point center, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) { @@ -828,20 +745,6 @@ public void Circle(Point center, int radius, Scalar color, #region Ellipse -#if LANG_JP - /// - /// 枠だけの楕円,楕円弧,もしくは塗りつぶされた扇形の楕円を描画する - /// - /// 楕円の中心 - /// 楕円の軸の長さ - /// 回転角度 - /// 楕円弧の開始角度 - /// 楕円弧の終了角度 - /// 楕円の色 - /// 楕円弧の線の幅 [既定値は1] - /// 楕円弧の線の種類 [既定値はLineType.Link8] - /// 中心座標と軸の長さの小数点以下の桁を表すビット数 [既定値は0] -#else /// /// Draws simple or thick elliptic arc or fills ellipse sector /// @@ -854,7 +757,6 @@ public void Circle(Point center, int radius, Scalar color, /// Thickness of the ellipse arc. [By default this is 1] /// Type of the ellipse boundary. [By default this is LineType.Link8] /// Number of fractional bits in the center coordinates and axes' values. [By default this is 0] -#endif public void Ellipse( Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0) @@ -862,15 +764,6 @@ public void Ellipse( Cv2.Ellipse(this, center, axes, angle, startAngle, endAngle, color, thickness, lineType, shift); } -#if LANG_JP - /// - /// 枠だけの楕円,もしくは塗りつぶされた楕円を描画する - /// - /// 描画したい楕円を囲む矩形領域. - /// 楕円の色. - /// 楕円境界線の幅.[既定値は1] - /// 楕円境界線の種類.[既定値はLineType.Link8] -#else /// /// Draws simple or thick elliptic arc or fills ellipse sector /// @@ -878,7 +771,6 @@ public void Ellipse( /// Ellipse color. /// Thickness of the ellipse boundary. [By default this is 1] /// Type of the ellipse boundary. [By default this is LineType.Link8] -#endif public void Ellipse(RotatedRect box, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8) { @@ -908,15 +800,6 @@ public void DrawMarker( #region FillConvexPoly -#if LANG_JP - /// - /// 塗りつぶされた凸ポリゴンを描きます. - /// - /// ポリゴンの頂点. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. -#else /// /// Fills a convex polygon. /// @@ -924,7 +807,6 @@ public void DrawMarker( /// Polygon color /// Type of the polygon boundaries /// The number of fractional bits in the vertex coordinates -#endif public void FillConvexPoly(IEnumerable pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0) { @@ -935,25 +817,6 @@ public void FillConvexPoly(IEnumerable pts, Scalar color, #region FillPoly -#if LANG_JP - /// - /// 1つ,または複数のポリゴンで区切られた領域を塗りつぶします. - /// - /// ポリゴンの配列.各要素は,点の配列で表現されます. - /// ポリゴンの色. - /// ポリゴンの枠線の種類, - /// ポリゴンの頂点座標において,小数点以下の桁を表すビット数. - /// -#else - /// - /// Fills the area bounded by one or more polygons - /// - /// Array of polygons, each represented as an array of points - /// Polygon color - /// Type of the polygon boundaries - /// The number of fractional bits in the vertex coordinates - /// -#endif public void FillPoly(IEnumerable> pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null) { @@ -1288,16 +1151,6 @@ public Mat Laplacian(MatType ddepth, return dst; } -#if LANG_JP - /// - /// Cannyアルゴリズムを用いて,画像のエッジを検出します. - /// - /// ヒステリシスが存在する処理の,1番目の閾値 - /// ヒステリシスが存在する処理の,2番目の閾値 - /// Sobelオペレータのアパーチャサイズ [既定値はApertureSize.Size3] - /// 画像勾配の強度を求めるために,より精度の高い L2ノルムを利用するか,L1ノルムで十分(false)かを指定します. [既定値はfalse] - /// 出力されるエッジのマップ. image と同じサイズ,同じ型 -#else /// /// Finds edges in an image using Canny algorithm. /// @@ -1306,7 +1159,6 @@ public Mat Laplacian(MatType ddepth, /// Aperture size for the Sobel operator [By default this is ApertureSize.Size3] /// Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false] /// The output edge map. It will have the same size and the same type as image -#endif // ReSharper disable once InconsistentNaming public Mat Canny(double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false) { @@ -1385,18 +1237,6 @@ public Point2f[] GoodFeaturesToTrack( minDistance, mask, blockSize, useHarrisDetector, k); } -#if LANG_JP - /// - /// 標準ハフ変換を用いて,2値画像から直線を検出します. - /// - /// ピクセル単位で表される投票空間の距離分解能 - /// ラジアン単位で表される投票空間の角度分解能 - /// 投票の閾値パラメータ.十分な票( > threshold )を得た直線のみが出力されます - /// マルチスケールハフ変換において,距離分解能 rho の除数となる値.[既定値は0] - /// マルチスケールハフ変換において,角度分解能 theta の除数となる値. [既定値は0] - /// 検出された直線.各直線は,2要素のベクトル (rho, theta) で表現されます. - /// rho は原点(画像の左上コーナー)からの距離, theta はラジアン単位で表される直線の回転角度です -#else /// /// Finds lines in a binary image using standard Hough transform. /// The input matrix must be 8-bit, single-channel, binary source image. @@ -1409,24 +1249,12 @@ public Point2f[] GoodFeaturesToTrack( /// For the multi-scale Hough transform it is the divisor for the distance resolution theta. [By default this is 0] /// The output vector of lines. Each line is represented by a two-element vector (rho, theta) . /// rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians -#endif public LineSegmentPolar[] HoughLines(double rho, double theta, int threshold, double srn = 0, double stn = 0) { return Cv2.HoughLines(this, rho, theta, threshold, srn, stn); } -#if LANG_JP - /// - /// 確率的ハフ変換を利用して,2値画像から線分を検出します. - /// - /// ピクセル単位で表される投票空間の距離分解能 - /// ラジアン単位で表される投票空間の角度分解能 - /// 投票の閾値パラメータ.十分な票( > threshold )を得た直線のみが出力されます - /// 最小の線分長.これより短い線分は棄却されます. [既定値は0] - /// 2点が同一線分上にあると見なす場合に許容される最大距離. [既定値は0] - /// 検出された線分.各線分は,4要素のベクトル (x1, y1, x2, y2) で表現されます. -#else /// /// Finds lines segments in a binary image using probabilistic Hough transform. /// @@ -1436,26 +1264,12 @@ public LineSegmentPolar[] HoughLines(double rho, double theta, int threshold, /// The minimum line length. Line segments shorter than that will be rejected. [By default this is 0] /// The maximum allowed gap between points on the same line to link them. [By default this is 0] /// The output lines. Each line is represented by a 4-element vector (x1, y1, x2, y2) -#endif public LineSegmentPoint[] HoughLinesP(double rho, double theta, int threshold, double minLineLength = 0, double maxLineGap = 0) { return Cv2.HoughLinesP(this, rho, theta, threshold, minLineLength, maxLineGap); } -#if LANG_JP - /// - /// ハフ変換を用いて,グレースケール画像から円を検出します. - /// - /// 現在のところ,HoughCirclesMethod.Gradient メソッドのみが実装されている. - /// 画像分解能に対する投票分解能の比率の逆数. - /// 検出される円の中心同士の最小距離. - /// 手法依存の1番目のパラメータ.[既定値は100] - /// 手法依存の2番目のパラメータ.[既定値は100] - /// 円の半径の最小値 [既定値は0] - /// 円の半径の最大値 [既定値は0] - /// 検出された円.各ベクトルは,3要素の浮動小数点型ベクトル (x, y, radius) としてエンコードされます -#else /// /// Finds circles in a grayscale image using a Hough transform. /// The input matrix must be 8-bit, single-channel and grayscale. @@ -1468,24 +1282,12 @@ public LineSegmentPoint[] HoughLinesP(double rho, double theta, int threshold, /// Minimum circle radius. [By default this is 0] /// Maximum circle radius. [By default this is 0] /// The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius) -#endif - public CircleSegment[] HoughCircles(HoughMethods method, double dp, double minDist, + public CircleSegment[] HoughCircles(HoughModes method, double dp, double minDist, double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0) { return Cv2.HoughCircles(this, method, dp, minDist, param1, param2, minRadius, maxRadius); } -#if LANG_JP - /// - /// 指定の構造要素を用いて画像の膨張を行います. - /// - /// 膨張に用いられる構造要素. element=new Mat() の場合, 3x3 の矩形構造要素が用いられます - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します - /// 膨張が行われる回数. [既定値は1] - /// ピクセル外挿手法.[既定値はBorderTypes.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます.[既定値はCvCpp.MorphologyDefaultBorderValue()] - /// src と同じサイズ,同じ型の出力画像 -#else /// /// Dilates an image by using a specific structuring element. /// @@ -1495,7 +1297,6 @@ public CircleSegment[] HoughCircles(HoughMethods method, double dp, double minDi /// The pixel extrapolation method. [By default this is BorderTypes.Constant] /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] /// The destination image. It will have the same size and the same type as src -#endif public Mat Dilate(InputArray? element, Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) { @@ -1504,17 +1305,6 @@ public Mat Dilate(InputArray? element, Point? anchor = null, int iterations = 1, return dst; } -#if LANG_JP - /// - /// 指定の構造要素を用いて画像の収縮を行います. - /// - /// 収縮に用いられる構造要素. element=new Mat() の場合, 3x3 の矩形の構造要素が用いられます - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します - /// 収縮が行われる回数. [既定値は1] - /// ピクセル外挿手法.[既定値はBorderTypes.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます.[既定値はCvCpp.MorphologyDefaultBorderValue()] - /// src と同じサイズ,同じ型の出力画像 -#else /// /// Erodes an image by using a specific structuring element. /// @@ -1524,7 +1314,6 @@ public Mat Dilate(InputArray? element, Point? anchor = null, int iterations = 1, /// The pixel extrapolation method /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] /// The destination image. It will have the same size and the same type as src -#endif public Mat Erode(InputArray? element, Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) { @@ -1533,18 +1322,6 @@ public Mat Erode(InputArray? element, Point? anchor = null, int iterations = 1, return dst; } -#if LANG_JP - /// - /// 高度なモルフォロジー変換を行います. - /// - /// モルフォロジー演算の種類 - /// 構造要素 - /// 構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します. - /// 収縮と膨張が適用される回数. [既定値は1] - /// ピクセル外挿手法. [既定値はBorderTypes.Constant] - /// 定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます. [既定値は CvCpp.MorphologyDefaultBorderValue()] - /// src と同じサイズ,同じ型の出力画像 -#else /// /// Performs advanced morphological transformations /// @@ -1555,7 +1332,6 @@ public Mat Erode(InputArray? element, Point? anchor = null, int iterations = 1, /// The pixel extrapolation method. [By default this is BorderTypes.Constant] /// The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()] /// Destination image. It will have the same size and the same type as src -#endif public Mat MorphologyEx(MorphTypes op, InputArray? element, Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null) @@ -1972,21 +1748,12 @@ public int FloodFill(InputOutputArray mask, Point seedPoint, Scalar newVal, newVal, out rect, loDiff, upDiff, flags); } -#if LANG_JP - /// - /// 画像の色空間を変換します. - /// - /// 色空間の変換コード. - /// 出力画像のチャンネル数.この値が 0 の場合,チャンネル数は src と code から自動的に求められます - /// src と同じサイズ,同じタイプの出力画像 -#else /// /// Converts image from one color space to another /// /// The color space conversion code /// The number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from src and the code /// The destination image; will have the same size and the same depth as src -#endif public Mat CvtColor(ColorConversionCodes code, int dstCn = 0) { var dst = new Mat(); @@ -2129,21 +1896,6 @@ public ConnectedComponents ConnectedComponentsEx(PixelConnectivity connectivity return Cv2.ConnectedComponentsEx(this, connectivity); } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// 入力画像は,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像の中身を書き換えます. - /// - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. - /// 画像のトポロジーに関する情報を含む出力ベクトル.これは,輪郭数と同じ数の要素を持ちます.各輪郭 contours[i] に対して, - /// 要素 hierarchy[i]のメンバにはそれぞれ,同じ階層レベルに存在する前後の輪郭,最初の子輪郭,および親輪郭の - /// contours インデックス(0 基準)がセットされます.また,輪郭 i において,前後,親,子の輪郭が存在しない場合, - /// それに対応する hierarchy[i] の要素は,負の値になります. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. -#else /// /// Finds contours in a binary image. /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. @@ -2159,28 +1911,12 @@ public ConnectedComponents ConnectedComponentsEx(PixelConnectivity connectivity /// Contour approximation method /// Optional offset by which every contour point is shifted. /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. -#endif public void FindContours(out Point[][] contours, out HierarchyIndex[] hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) { Cv2.FindContours(this, out contours, out hierarchy, mode, method, offset); } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// 入力画像は,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像の中身を書き換えます. - /// - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. - /// 画像のトポロジーに関する情報を含む出力ベクトル.これは,輪郭数と同じ数の要素を持ちます.各輪郭 contours[i] に対して, - /// 要素 hierarchy[i]のメンバにはそれぞれ,同じ階層レベルに存在する前後の輪郭,最初の子輪郭,および親輪郭の - /// contours インデックス(0 基準)がセットされます.また,輪郭 i において,前後,親,子の輪郭が存在しない場合, - /// それに対応する hierarchy[i] の要素は,負の値になります. - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. -#else /// /// Finds contours in a binary image. /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. @@ -2196,24 +1932,12 @@ public void FindContours(out Point[][] contours, out HierarchyIndex[] hierarchy, /// Contour approximation method /// Optional offset by which every contour point is shifted. /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. -#endif public void FindContours(out Mat[] contours, OutputArray hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null) { Cv2.FindContours(this, out contours, hierarchy, mode, method, offset); } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// 入力画像は,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像の中身を書き換えます. - /// - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. -#else /// /// Finds contours in a binary image. /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. @@ -2224,23 +1948,11 @@ public void FindContours(out Mat[] contours, OutputArray hierarchy, /// Optional offset by which every contour point is shifted. /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. /// Detected contours. Each contour is stored as a vector of points. -#endif public Point[][] FindContoursAsArray(RetrievalModes mode, ContourApproximationModes method, Point? offset = null) { return Cv2.FindContoursAsArray(this, mode, method, offset); } -#if LANG_JP - /// - /// 2値画像中の輪郭を検出します. - /// 入力画像は,8ビット,シングルチャンネル.0以外のピクセルは 1として,0のピクセルは0のまま扱われます. - /// また,この関数は,輪郭抽出処理中に入力画像の中身を書き換えます. - /// - /// 輪郭抽出モード - /// 輪郭の近似手法 - /// オプションのオフセット.各輪郭点はこの値の分だけシフトします.これは,ROIの中で抽出された輪郭を,画像全体に対して位置づけて解析する場合に役立ちます. - /// 検出された輪郭.各輪郭は,点のベクトルとして格納されます. -#else /// /// Finds contours in a binary image. /// The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. @@ -2251,28 +1963,11 @@ public Point[][] FindContoursAsArray(RetrievalModes mode, ContourApproximationMo /// Optional offset by which every contour point is shifted. /// This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context. /// Detected contours. Each contour is stored as a vector of points. -#endif public Mat[] FindContoursAsMat(RetrievalModes mode, ContourApproximationModes method, Point? offset = null) { return Cv2.FindContoursAsMat(this, mode, method, offset); } -#if LANG_JP - /// - /// 輪郭線,または内側が塗りつぶされた輪郭を描きます. - /// - /// 入力される全輪郭.各輪郭は,点のベクトルとして格納されています. - /// 描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます. - /// 輪郭の色. - /// 輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます. - /// 線の連結性 - /// 階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります. - /// 描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます. - /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と, - /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, - /// hierarchy が有効な場合のみ考慮されます. - /// 輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます. -#else /// /// Draws contours in the image /// @@ -2288,7 +1983,6 @@ public Mat[] FindContoursAsMat(RetrievalModes mode, ContourApproximationM /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account /// when there is hierarchy available. /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) -#endif public void DrawContours( IEnumerable> contours, int contourIdx, @@ -2303,22 +1997,6 @@ public void DrawContours( thickness, lineType, hierarchy, maxLevel, offset); } -#if LANG_JP - /// - /// 輪郭線,または内側が塗りつぶされた輪郭を描きます. - /// - /// 入力される全輪郭.各輪郭は,点のベクトルとして格納されています. - /// 描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます. - /// 輪郭の色. - /// 輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます. - /// 線の連結性 - /// 階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります. - /// 描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます. - /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と, - /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, - /// hierarchy が有効な場合のみ考慮されます. - /// 輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます. -#else /// /// Draws contours in the image /// @@ -2334,7 +2012,6 @@ public void DrawContours( /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account /// when there is hierarchy available. /// Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy) -#endif public void DrawContours( IEnumerable contours, int contourIdx, @@ -2360,7 +2037,7 @@ public void DrawContours( /// The type should match the type of the input curve /// The result of the approximation; /// The type should match the type of the input curve -// ReSharper disable once InconsistentNaming + // ReSharper disable once InconsistentNaming public Mat ApproxPolyDP(double epsilon, bool closed) { var dst = new Mat(); @@ -2603,7 +2280,7 @@ public double PointPolygonTest(Point2f pt, bool measureDist) /// /// /// - public Mat DistanceTransform(DistanceTypes distanceType, DistanceMaskSize maskSize) + public Mat DistanceTransform(DistanceTypes distanceType, DistanceTransformMasks maskSize) { var dst = new Mat(); Cv2.DistanceTransform(this, dst, distanceType, maskSize); diff --git a/src/OpenCvSharp/Modules/core/Mat/UMat.cs b/src/OpenCvSharp/Modules/core/Mat/UMat.cs index ba583c62e..644a2c6a1 100644 --- a/src/OpenCvSharp/Modules/core/Mat/UMat.cs +++ b/src/OpenCvSharp/Modules/core/Mat/UMat.cs @@ -76,17 +76,10 @@ public class UMat : DisposableCvObject [typeof(DMatch)] = MatType.CV_32FC4, }; -#if LANG_JP - /// - /// OpenCVネイティブの cv::Mat* ポインタから初期化 - /// - /// -#else /// /// Creates from native cv::Mat* pointer /// /// -#endif public UMat(IntPtr ptr) { if (ptr == IntPtr.Zero) @@ -94,15 +87,9 @@ public UMat(IntPtr ptr) this.ptr = ptr; } -#if LANG_JP - /// - /// 空の行列として初期化 - /// -#else /// /// Creates empty Mat /// -#endif public UMat(UMatUsageFlags usageFlags = UMatUsageFlags.Default) { NativeMethods.HandleException( @@ -125,16 +112,6 @@ protected UMat(UMat m) throw new OpenCvSharpException("imread failed."); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// usage flags for allocator -#else /// /// constructs 2D matrix of the specified size and type /// @@ -143,22 +120,12 @@ protected UMat(UMat m) /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. /// usage flags for allocator -#endif public UMat(int rows, int cols, MatType type, UMatUsageFlags usageFlags = UMatUsageFlags.Default) { NativeMethods.HandleException( NativeMethods.core_UMat_new2(rows, cols, type, (int)usageFlags, out ptr)); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) . Size コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// usage flags for allocator -#else /// /// constructs 2D matrix of the specified size and type /// @@ -167,25 +134,12 @@ public UMat(int rows, int cols, MatType type, UMatUsageFlags usageFlags = UMatUs /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType.CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. /// usage flags for allocator -#endif public UMat(Size size, MatType type, UMatUsageFlags usageFlags = UMatUsageFlags.Default) { NativeMethods.HandleException( NativeMethods.core_UMat_new2(size.Height, size.Width, type, (int)usageFlags, out ptr)); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. - /// usage flags for allocator -#else /// /// constructs 2D matrix and fills it with the specified Scalar value. /// @@ -196,24 +150,12 @@ public UMat(Size size, MatType type, UMatUsageFlags usageFlags = UMatUsageFlags. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . /// usage flags for allocator -#endif public UMat(int rows, int cols, MatType type, Scalar s, UMatUsageFlags usageFlags = UMatUsageFlags.Default) { NativeMethods.HandleException( NativeMethods.core_UMat_new3(rows, cols, type, s, (int)usageFlags, out ptr)); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) . Size() コンストラクタでは,行数と列数が逆順になっていることに注意してください. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. - /// usage flags for allocator -#else /// /// constructs 2D matrix and fills it with the specified Scalar value. /// @@ -224,28 +166,12 @@ public UMat(int rows, int cols, MatType type, Scalar s, UMatUsageFlags usageFlag /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . /// usage flags for allocator -#endif public UMat(Size size, MatType type, Scalar s, UMatUsageFlags usageFlags = UMatUsageFlags.Default) { NativeMethods.HandleException( NativeMethods.core_UMat_new3(size.Height, size.Width, type, s, (int)usageFlags, out ptr)); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. - /// usage flags for allocator -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -258,7 +184,6 @@ public UMat(Size size, MatType type, Scalar s, UMatUsageFlags usageFlags = UMatU /// Use Range.All to take all the rows. /// Range of the m columns to take. Use Range.All to take all the columns. /// usage flags for allocator -#endif public UMat(UMat m, Range rowRange, Range colRange, UMatUsageFlags usageFlags = UMatUsageFlags.Default) { if (m == null) @@ -269,19 +194,6 @@ public UMat(UMat m, Range rowRange, Range colRange, UMatUsageFlags usageFlags = GC.KeepAlive(m); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 多次元行列の各次元毎の選択範囲を表す配列. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -291,7 +203,6 @@ public UMat(UMat m, Range rowRange, Range colRange, UMatUsageFlags usageFlags = /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . /// If you want to have an independent copy of the sub-array, use Mat.Clone() . /// Array of selected ranges of m along each dimensionality. -#endif public UMat(UMat m, params Range[] ranges) { if (m == null) @@ -307,19 +218,6 @@ public UMat(UMat m, params Range[] ranges) GC.KeepAlive(m); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// これらのコンストラクタによってデータがコピーされる事はありません. - /// 代わりに,データ m ,またはその部分配列を指し示すヘッダが作成され, - /// 関連した参照カウンタがあれば,それがインクリメントされます. - /// つまり,新しく作成された配列の内容を変更することで, m の対応する要素も - /// 変更することになります.もし部分配列の独立したコピーが必要ならば, - /// Mat.Clone() を利用してください. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -329,7 +227,6 @@ public UMat(UMat m, params Range[] ranges) /// So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . /// If you want to have an independent copy of the sub-array, use Mat.Clone() . /// Region of interest. -#endif public UMat(UMat m, Rect roi) { if (m == null) @@ -341,21 +238,12 @@ public UMat(UMat m, Rect roi) GC.KeepAlive(m); } -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else /// /// constructs n-dimensional matrix /// /// Array of integers specifying an n-dimensional array shape. /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif public UMat(IEnumerable sizes, MatType type) { if (sizes == null) @@ -366,16 +254,6 @@ public UMat(IEnumerable sizes, MatType type) NativeMethods.core_UMat_new4(sizesArray.Length, sizesArray, type, out ptr)); } -#if LANG_JP - /// - /// N次元行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constructs n-dimensional matrix /// @@ -384,7 +262,6 @@ public UMat(IEnumerable sizes, MatType type) /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public UMat(IEnumerable sizes, MatType type, Scalar s) { if (sizes == null) @@ -394,15 +271,9 @@ public UMat(IEnumerable sizes, MatType type, Scalar s) NativeMethods.core_UMat_new5(sizesArray.Length, sizesArray, type, s, out ptr)); } -#if LANG_JP -/// -/// リソースの解放 -/// -#else /// /// Releases the resources /// -#endif public void Release() { Dispose(); @@ -1579,18 +1450,10 @@ public override string ToString() #region EmptyClone -#if LANG_JP - /// - /// このMatと同じサイズ・ビット深度・チャネル数を持つ - /// Matオブジェクトを新たに作成し、返す - /// - /// コピーされた画像 -#else /// /// Makes a Mat that have the same size, depth and channels as this image /// /// -#endif public UMat EmptyClone(UMatUsageFlags usageFlags = UMatUsageFlags.Default) { ThrowIfDisposed(); diff --git a/src/OpenCvSharp/Modules/core/PCA.cs b/src/OpenCvSharp/Modules/core/PCA.cs index 52e027676..5385e9e03 100644 --- a/src/OpenCvSharp/Modules/core/PCA.cs +++ b/src/OpenCvSharp/Modules/core/PCA.cs @@ -347,39 +347,19 @@ public void Read(FileNode fn) [Flags] public enum Flags { -#if LANG_JP - /// - /// 行としてベクトルが保存される(つまり,あるベクトルの全ての要素は連続的に保存される) - /// -#else /// /// The vectors are stored as rows (i.e. all the components of a certain vector are stored continously) /// -#endif DataAsRow = 0, - -#if LANG_JP - /// - /// 列としてベクトルが保存される(つまり,あるベクトル成分に属する値は連続的に保存される) - /// -#else /// /// The vectors are stored as columns (i.e. values of a certain vector component are stored continuously) /// -#endif DataAsCol = 1, - -#if LANG_JP - /// - /// 事前に計算された平均ベクトルを用いる - /// -#else /// /// Use pre-computed average vector /// -#endif UseAvg = 2, } } diff --git a/src/OpenCvSharp/Modules/core/SVD.cs b/src/OpenCvSharp/Modules/core/SVD.cs index 1b65abb17..f6bf7dd11 100644 --- a/src/OpenCvSharp/Modules/core/SVD.cs +++ b/src/OpenCvSharp/Modules/core/SVD.cs @@ -230,15 +230,9 @@ public static void SolveZ(InputArray src, OutputArray dst) GC.KeepAlive(dst); } -#if LANG_JP - /// - /// SVDの操作フラグ - /// -#else /// /// Operation flags for SVD /// -#endif [Flags] public enum Flags { @@ -247,22 +241,16 @@ public enum Flags /// None = 0, -#if LANG_JP - /// - /// 計算中に行列Aの変更を行うことができる.このフラグの指定は処理速度を向上させる. - /// -#else /// /// enables modification of matrix src1 during the operation. It speeds up the processing. /// -#endif ModifyA = 1, /// /// indicates that only a vector of singular values `w` is to be processed, /// while u and vt will be set to empty matrices /// -// ReSharper disable once InconsistentNaming + // ReSharper disable once InconsistentNaming NoUV = 2, /// @@ -271,7 +259,7 @@ public enum Flags /// if, however, FULL_UV flag is specified, u and vt will be full-size square /// orthogonal matrices. /// -// ReSharper disable once InconsistentNaming + // ReSharper disable once InconsistentNaming FullUV = 4, } } diff --git a/src/OpenCvSharp/Modules/core/SparseMat.cs b/src/OpenCvSharp/Modules/core/SparseMat.cs index feafd63f9..e1b23c37e 100644 --- a/src/OpenCvSharp/Modules/core/SparseMat.cs +++ b/src/OpenCvSharp/Modules/core/SparseMat.cs @@ -13,17 +13,10 @@ public class SparseMat : DisposableCvObject { #region Init & Disposal -#if LANG_JP - /// - /// OpenCVネイティブの cv::SparseMat* ポインタから初期化 - /// - /// -#else /// /// Creates from native cv::SparseMat* pointer /// /// -#endif public SparseMat(IntPtr ptr) { if (ptr == IntPtr.Zero) @@ -31,36 +24,21 @@ public SparseMat(IntPtr ptr) this.ptr = ptr; } -#if LANG_JP - /// - /// 空の疎行列として初期化 - /// -#else /// /// Creates empty SparseMat /// -#endif public SparseMat() { NativeMethods.HandleException( NativeMethods.core_SparseMat_new1(out ptr)); } -#if LANG_JP - /// - /// N次元疎行列として初期化 - /// - /// n-次元配列の形状を表す,整数型の配列. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else /// /// constructs n-dimensional sparse matrix /// /// Array of integers specifying an n-dimensional array shape. /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif public SparseMat(IEnumerable sizes, MatType type) { if (sizes == null) @@ -71,17 +49,10 @@ public SparseMat(IEnumerable sizes, MatType type) NativeMethods.core_SparseMat_new2(sizesArray.Length, sizesArray, type, out ptr)); } -#if LANG_JP - /// - /// cv::Matデータから初期化 - /// - /// cv::Matオブジェクトへの参照. -#else /// /// converts old-style CvMat to the new matrix; the data is not copied by default /// /// cv::Mat object -#endif public SparseMat(Mat m) { if (m == null) @@ -96,15 +67,9 @@ public SparseMat(Mat m) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// リソースの解放 - /// -#else /// /// Releases the resources /// -#endif public void Release() { Dispose(); diff --git a/src/OpenCvSharp/Modules/core/Struct/KeyPoint.cs b/src/OpenCvSharp/Modules/core/Struct/KeyPoint.cs index a5d902543..96f8320d5 100644 --- a/src/OpenCvSharp/Modules/core/Struct/KeyPoint.cs +++ b/src/OpenCvSharp/Modules/core/Struct/KeyPoint.cs @@ -2,106 +2,51 @@ using System.Globalization; using System.Runtime.InteropServices; -#pragma warning disable CA1051 - namespace OpenCvSharp { -#if LANG_JP - /// - /// 特徴点検出器のためのデータ構造体 - /// -#else /// /// Data structure for salient point detectors /// -#endif [Serializable] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct KeyPoint : IEquatable { #region Properties -#if LANG_JP - /// - /// 特徴点の座標 - /// -#else /// /// Coordinate of the point /// -#endif public Point2f Pt; -#if LANG_JP - /// - /// 特徴点のサイズ - /// -#else /// /// Feature size /// -#endif public float Size; -#if LANG_JP - /// - /// 特徴点の向き(度数法)。 向きが定義されない、若しくは計算されない場合には負数。 - /// -#else /// /// Feature orientation in degrees (has negative value if the orientation is not defined/not computed) /// -#endif public float Angle; -#if LANG_JP - /// - /// 特徴点の強さ(もっとも顕著なキーポイントを求めるために使われる) - /// -#else /// /// Feature strength (can be used to select only the most prominent key points) /// -#endif public float Response; -#if LANG_JP - /// - /// 特徴点が見つかったscale-spaceのoctave。サイズと相関がある場合がある。 - /// -#else /// /// Scale-space octave in which the feature has been found; may correlate with the size /// -#endif public int Octave; -#if LANG_JP - /// - /// 特徴点のクラス(特徴点分類機または物体検出器において用いられる) - /// -#else /// /// Point class (can be used by feature classifiers or object detectors) /// -#endif public int ClassId; #endregion #region Constructors -#if LANG_JP - /// - /// 初期化 - /// - /// 特徴点の座標 - /// 特徴点のサイズ - /// 特徴点の向き(度数法)。 向きが定義されない、若しくは計算されない場合には負数。 - /// 特徴点の強さ(もっとも顕著なキーポイントを求めるために使われる) - /// 特徴点が見つかったscale-spaceのoctave。サイズと相関がある場合がある。 - /// 特徴点のクラス(特徴点分類機または物体検出器において用いられる) -#else /// /// Complete constructor /// @@ -111,7 +56,6 @@ public struct KeyPoint : IEquatable /// Feature strength (can be used to select only the most prominent key points) /// Scale-space octave in which the feature has been found; may correlate with the size /// Point class (can be used by feature classifiers or object detectors) -#endif public KeyPoint(Point2f pt, float size, float angle = -1, float response = 0, int octave = 0, int classId = -1) { @@ -123,18 +67,6 @@ public KeyPoint(Point2f pt, float size, float angle = -1, float response = 0, in ClassId = classId; } -#if LANG_JP - /// - /// 初期化 - /// - /// 特徴点のx座標 - /// 特徴点のy座標 - /// 特徴点のサイズ - /// 特徴点の向き(度数法)。 向きが定義されない、若しくは計算されない場合には負数。 - /// 特徴点の強さ(もっとも顕著なキーポイントを求めるために使われる) - /// 特徴点が見つかったscale-spaceのoctave。サイズと相関がある場合がある。 - /// 特徴点のクラス(特徴点分類機または物体検出器において用いられる) -#else /// /// Complete constructor /// @@ -145,7 +77,6 @@ public KeyPoint(Point2f pt, float size, float angle = -1, float response = 0, in /// Feature strength (can be used to select only the most prominent key points) /// Scale-space octave in which the feature has been found; may correlate with the size /// Point class (can be used by feature classifiers or object detectors) -#endif public KeyPoint(float x, float y, float size, float angle = -1, float response = 0, int octave = 0, int classId = -1) : this(new Point2f(x, y), size, angle, response, octave, classId) @@ -156,41 +87,23 @@ public KeyPoint(float x, float y, float size, float angle = -1, float response = #region Operators -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(KeyPoint lhs, KeyPoint rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(KeyPoint lhs, KeyPoint rhs) { return !lhs.Equals(rhs); @@ -238,6 +151,5 @@ public override readonly string ToString() } #endregion - } } diff --git a/src/OpenCvSharp/Modules/core/Struct/Point.cs b/src/OpenCvSharp/Modules/core/Struct/Point.cs index f914b0207..4cf0c9010 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point.cs @@ -66,41 +66,23 @@ public Point(double x, double y) #region == / != -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two Point objects. The result specifies whether the values of the X and Y properties of the two Point objects are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif public static bool operator ==(Point lhs, Point rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two Point objects. The result specifies whether the values of the X or Y properties of the two Point objects are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif public static bool operator !=(Point lhs, Point rhs) { return !lhs.Equals(rhs); @@ -222,115 +204,64 @@ public override readonly string ToString() #region Methods -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// - /// -#else /// /// Returns the distance between the specified two points /// /// /// /// -#endif public static double Distance(Point p1, Point p2) { return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); } -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// -#else /// /// Returns the distance between the specified two points /// /// /// -#endif public readonly double DistanceTo(Point p) { return Distance(this, p); } -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// - /// -#else /// /// Calculates the dot product of two 2D vectors. /// /// /// /// -#endif public static double DotProduct(Point p1, Point p2) { return p1.X*p2.X + p1.Y*p2.Y; } -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// -#else /// /// Calculates the dot product of two 2D vectors. /// /// /// -#endif public readonly double DotProduct(Point p) { return DotProduct(this, p); } -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// - /// -#else /// /// Calculates the cross product of two 2D vectors. /// /// /// /// -#endif public static double CrossProduct(Point p1, Point p2) { return p1.X*p2.Y - p2.X*p1.Y; } -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// -#else /// /// Calculates the cross product of two 2D vectors. /// /// /// -#endif public readonly double CrossProduct(Point p) { return CrossProduct(this, p); diff --git a/src/OpenCvSharp/Modules/core/Struct/Point2d.cs b/src/OpenCvSharp/Modules/core/Struct/Point2d.cs index b73cdaeba..57b80fa7a 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point2d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point2d.cs @@ -64,41 +64,23 @@ public Point2d(double x, double y) #region == / != -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif public static bool operator ==(Point2d lhs, Point2d rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif public static bool operator !=(Point2d lhs, Point2d rhs) { return !lhs.Equals(rhs); @@ -220,115 +202,64 @@ public override readonly string ToString() #region Methods -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// - /// -#else /// /// Returns the distance between the specified two points /// /// /// /// -#endif public static double Distance(Point2d p1, Point2d p2) { return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); } -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// -#else /// /// Returns the distance between the specified two points /// /// /// -#endif public readonly double DistanceTo(Point2d p) { return Distance(this, p); } -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// - /// -#else /// /// Calculates the dot product of two 2D vectors. /// /// /// /// -#endif public static double DotProduct(Point2d p1, Point2d p2) { return p1.X*p2.X + p1.Y*p2.Y; } -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// -#else /// /// Calculates the dot product of two 2D vectors. /// /// /// -#endif public readonly double DotProduct(Point2d p) { return DotProduct(this, p); } -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// - /// -#else /// /// Calculates the cross product of two 2D vectors. /// /// /// /// -#endif public static double CrossProduct(Point2d p1, Point2d p2) { return p1.X*p2.Y - p2.X*p1.Y; } -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// -#else /// /// Calculates the cross product of two 2D vectors. /// /// /// -#endif public readonly double CrossProduct(Point2d p) { return CrossProduct(this, p); diff --git a/src/OpenCvSharp/Modules/core/Struct/Point2f.cs b/src/OpenCvSharp/Modules/core/Struct/Point2f.cs index 33757699f..b0439b1c0 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point2f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point2f.cs @@ -65,41 +65,23 @@ public Point2f(float x, float y) #region == / != -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif public static bool operator ==(Point2f lhs, Point2f rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif public static bool operator !=(Point2f lhs, Point2f rhs) { return !lhs.Equals(rhs); @@ -224,121 +206,69 @@ public override readonly string ToString() #region Methods -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// - /// -#else /// /// Returns the distance between the specified two points /// /// /// /// -#endif public static double Distance(Point2f p1, Point2f p2) { return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow(p2.Y - p1.Y, 2)); } -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// - /// -#else /// /// Returns the distance between the specified two points /// /// /// -#endif public readonly double DistanceTo(Point2f p) { return Distance(this, p); } -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// - /// -#else /// /// Calculates the dot product of two 2D vectors. /// /// /// /// -#endif public static double DotProduct(Point2f p1, Point2f p2) { return p1.X*p2.X + p1.Y*p2.Y; } -#if LANG_JP - /// - /// ベクトルの内積を求める - /// - /// - /// -#else /// /// Calculates the dot product of two 2D vectors. /// /// /// -#endif public readonly double DotProduct(Point2f p) { return DotProduct(this, p); } -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// - /// -#else /// /// Calculates the cross product of two 2D vectors. /// /// /// /// -#endif public static double CrossProduct(Point2f p1, Point2f p2) { return p1.X*p2.Y - p2.X*p1.Y; } -#if LANG_JP - /// - /// ベクトルの外積を求める - /// - /// - /// -#else /// /// Calculates the cross product of two 2D vectors. /// /// /// -#endif public readonly double CrossProduct(Point2f p) { return CrossProduct(this, p); } #endregion - } } diff --git a/src/OpenCvSharp/Modules/core/Struct/Point3d.cs b/src/OpenCvSharp/Modules/core/Struct/Point3d.cs index 086914fc2..9db8c7a44 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point3d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point3d.cs @@ -72,41 +72,23 @@ public Point3d(double x, double y, double z) #region == / != -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif public static bool operator ==(Point3d lhs, Point3d rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif public static bool operator !=(Point3d lhs, Point3d rhs) { return !lhs.Equals(rhs); @@ -116,19 +98,11 @@ public Point3d(double x, double y, double z) #region + / - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else /// /// Unary plus operator /// /// /// -#endif public static Point3d operator +(Point3d pt) => pt; /// @@ -137,19 +111,11 @@ public Point3d(double x, double y, double z) /// public readonly Point3d Plus() => this; -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else /// /// Unary minus operator /// /// /// -#endif public static Point3d operator -(Point3d pt) => pt.Negate(); /// @@ -158,21 +124,12 @@ public Point3d(double x, double y, double z) /// public readonly Point3d Negate() => new(-X, -Y, -Z); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif public static Point3d operator +(Point3d p1, Point3d p2) => p1.Add(p2); /// @@ -182,21 +139,12 @@ public Point3d(double x, double y, double z) /// public readonly Point3d Add(Point3d p) => new(X + p.X, Y + p.Y, Z + p.Z); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif public static Point3d operator -(Point3d p1, Point3d p2) => p1.Subtract(p2); /// @@ -206,21 +154,12 @@ public Point3d(double x, double y, double z) /// public readonly Point3d Subtract(Point3d p) => new(X - p.X, Y - p.Y, Z - p.Z); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif public static Point3d operator *(Point3d pt, double scale) => pt.Multiply(scale); /// diff --git a/src/OpenCvSharp/Modules/core/Struct/Point3f.cs b/src/OpenCvSharp/Modules/core/Struct/Point3f.cs index 9c7c39975..5f6fa73d5 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point3f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point3f.cs @@ -71,41 +71,23 @@ public Point3f(float x, float y, float z) #region == / != -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif public static bool operator ==(Point3f lhs, Point3f rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif public static bool operator !=(Point3f lhs, Point3f rhs) { return !lhs.Equals(rhs); diff --git a/src/OpenCvSharp/Modules/core/Struct/Point3i.cs b/src/OpenCvSharp/Modules/core/Struct/Point3i.cs index 1646efec5..0ce200d57 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Point3i.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Point3i.cs @@ -63,41 +63,23 @@ public Point3i(int x, int y, int z) #region == / != -#if LANG_JP - /// - /// == 演算子のオーバーロード。x,y座標値が等しければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the values of the X and Y properties of the two CvPoint objects are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the X and Y values of left and right are equal; otherwise, false. -#endif public static bool operator ==(Point3i lhs, Point3i rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード。x,y座標値が等しくなければtrueを返す - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint2D32f objects. The result specifies whether the values of the X or Y properties of the two CvPoint2D32f objects are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the values of either the X properties or the Y properties of left and right differ; otherwise, false. -#endif public static bool operator !=(Point3i lhs, Point3i rhs) { return !lhs.Equals(rhs); @@ -107,19 +89,11 @@ public Point3i(int x, int y, int z) #region + / - -#if LANG_JP - /// - /// 単項プラス演算子 - /// - /// - /// -#else /// /// Unary plus operator /// /// /// -#endif public static Point3i operator +(Point3i pt) => pt; /// @@ -128,19 +102,11 @@ public Point3i(int x, int y, int z) /// public readonly Point3i Plus() => this; -#if LANG_JP - /// - /// 単項マイナス演算子 - /// - /// - /// -#else /// /// Unary minus operator /// /// /// -#endif public static Point3i operator -(Point3i pt) { return pt.Negate(); @@ -152,21 +118,12 @@ public Point3i(int x, int y, int z) /// public readonly Point3i Negate() => new (-X, -Y, -Z); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif public static Point3i operator +(Point3i p1, Point3i p2) => p1.Add(p2); /// @@ -176,21 +133,12 @@ public Point3i(int x, int y, int z) /// public readonly Point3i Add(Point3i p) => new (X + p.X, Y + p.Y, Z + p.Z); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif public static Point3i operator -(Point3i p1, Point3i p2) => p1.Subtract(p2); /// @@ -200,21 +148,12 @@ public Point3i(int x, int y, int z) /// public readonly Point3i Subtract(Point3i p) => new (X - p.X, Y - p.Y, Z - p.Z); -#if LANG_JP - /// - /// あるオフセットで点を移動させる - /// - /// - /// - /// -#else /// /// Shifts point by a certain offset /// /// /// /// -#endif public static Point3i operator *(Point3i pt, double scale) => pt.Multiply(scale); /// diff --git a/src/OpenCvSharp/Modules/core/Struct/Rect.cs b/src/OpenCvSharp/Modules/core/Struct/Rect.cs index 25b03b48e..b9ceab85e 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Rect.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Rect.cs @@ -35,15 +35,9 @@ public struct Rect : IEquatable /// public int Height; -#if LANG_JP - /// - /// プロパティを初期化しない状態の Rect 構造体を表します。 - /// -#else /// /// Represents a Rect structure with its properties left uninitialized. /// -#endif public static readonly Rect Empty; #endregion @@ -105,41 +99,23 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) #region == / != -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two Rect objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(Rect lhs, Rect rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two Rect objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(Rect lhs, Rect rhs) { return !lhs.Equals(rhs); @@ -149,21 +125,12 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) #region + / - -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else /// /// Shifts rectangle by a certain offset /// /// /// /// -#endif public static Rect operator +(Rect rect, Point pt) => rect.Add(pt); /// @@ -173,21 +140,12 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) /// public readonly Rect Add(Point pt) => new (X + pt.X, Y + pt.Y, Width, Height); -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else /// /// Shifts rectangle by a certain offset /// /// /// /// -#endif public static Rect operator -(Rect rect, Point pt) { return new (rect.X - pt.X, rect.Y - pt.Y, rect.Width, rect.Height); @@ -200,21 +158,12 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) /// public readonly Rect Subtract(Point pt) => new(X - pt.X, Y - pt.Y, Width, Height); -#if LANG_JP - /// - /// 指定したサイズ応じて、矩形を膨張または縮小する - /// - /// - /// - /// -#else /// /// Expands or shrinks rectangle by a certain amount /// /// /// /// -#endif public static Rect operator +(Rect rect, Size size) { return new (rect.X, rect.Y, rect.Width + size.Width, rect.Height + size.Height); @@ -227,21 +176,12 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) /// public readonly Rect Add(Size size) => new (X, Y, Width + size.Width, Height + size.Height); -#if LANG_JP - /// - /// 指定したサイズ応じて、矩形を膨張または縮小する - /// - /// - /// - /// -#else /// /// Expands or shrinks rectangle by a certain amount /// /// /// /// -#endif public static Rect operator -(Rect rect, Size size) { return new Rect(rect.X, rect.Y, rect.Width - size.Width, rect.Height - size.Height); @@ -258,42 +198,24 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) #region & / | -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Determines the Rect structure that represents the intersection of two rectangles. /// /// A rectangle to intersect. /// A rectangle to intersect. /// -#endif [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect operator &(Rect a, Rect b) { return Intersect(a, b); } -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Gets a Rect structure that contains the union of two Rect structures. /// /// A rectangle to union. /// A rectangle to union. /// -#endif [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect operator |(Rect a, Rect b) { @@ -306,76 +228,40 @@ public static Rect FromLTRB(int left, int top, int right, int bottom) #region Properties -#if LANG_JP - /// - /// 上端のy座標 - /// -#else /// /// Gets the y-coordinate of the top edge of this Rect structure. /// -#endif public int Top { - get { return Y; } - set { Y = value; } + get => Y; + set => Y = value; } -#if LANG_JP - /// - /// 下端のy座標 (Y + Height) - /// -#else /// /// Gets the y-coordinate that is the sum of the Y and Height property values of this Rect structure. /// -#endif - public int Bottom - { - get { return Y + Height; } - } + public int Bottom => Y + Height; -#if LANG_JP - /// - /// 左端のx座標 - /// -#else /// /// Gets the x-coordinate of the left edge of this Rect structure. /// -#endif public int Left { - get { return X; } - set { X = value; } + get => X; + set => X = value; } -#if LANG_JP - /// - /// 右端のx座標 (X + Width) - /// -#else /// /// Gets the x-coordinate that is the sum of X and Width property values of this Rect structure. /// -#endif - public int Right - { - get { return X + Width; } - } + public int Right => X + Width; -#if LANG_JP - /// - /// 矩形の左上頂点の位置 [Point(X, Y)] - /// -#else /// /// Coordinate of the left-most rectangle corner [Point(X, Y)] /// -#endif public Point Location { - get { return new Point(X, Y); } + get => new (X, Y); set { X = value.X; @@ -383,18 +269,12 @@ public Point Location } } -#if LANG_JP - /// - /// 矩形の大きさ [CvSize(Width, Height)] - /// -#else /// /// Size of the rectangle [CvSize(Width, Height)] /// -#endif public Size Size { - get { return new Size(Width, Height); } + get => new (Width, Height); set { Width = value.Width; @@ -402,89 +282,46 @@ public Size Size } } -#if LANG_JP - /// - /// 左上の頂点 - /// -#else /// /// Coordinate of the left-most rectangle corner [Point(X, Y)] /// -#endif - public Point TopLeft - { - get { return new Point(X, Y); } - } + public Point TopLeft => new (X, Y); -#if LANG_JP - /// - /// 右下の頂点 - /// -#else /// /// Coordinate of the right-most rectangle corner [Point(X+Width, Y+Height)] /// -#endif - public Point BottomRight - { - get { return new Point(X + Width, Y + Height); } - } + public Point BottomRight => new (X + Width, Y + Height); #endregion #region Methods -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// x座標 - /// y座標 - /// -#else /// /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. /// /// x-coordinate of the point /// y-coordinate of the point /// -#endif public readonly bool Contains(int x, int y) { return (X <= x && Y <= y && X + Width > x && Y + Height > y); } -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// 点 - /// -#else /// /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. /// /// point /// -#endif public readonly bool Contains(Point pt) { return Contains(pt.X, pt.Y); } -#if LANG_JP - /// - /// 指定した矩形がこの矩形に含まれているかどうかを判断する - /// - /// 矩形 - /// -#else /// /// Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle. /// /// rectangle /// -#endif public readonly bool Contains(Rect rect) { return X <= rect.X && @@ -493,19 +330,11 @@ public readonly bool Contains(Rect rect) (rect.Y + rect.Height) <= (Y + Height); } -#if LANG_JP - /// - /// このRectを指定の量だけ膨らませる - /// - /// 水平方向の膨張量 - /// 垂直方向の膨張量 -#else /// /// Inflates this Rect by the specified amount. /// /// The amount to inflate this Rectangle horizontally. /// The amount to inflate this Rectangle vertically. -#endif public void Inflate(int width, int height) { X -= width; @@ -514,31 +343,15 @@ public void Inflate(int width, int height) Height += (2*height); } -#if LANG_JP - /// - /// このRectを指定の量だけ膨らませる - /// - /// この四角形の膨張量 -#else /// /// Inflates this Rect by the specified amount. /// /// The amount to inflate this rectangle. -#endif public void Inflate(Size size) { Inflate(size.Width, size.Height); } -#if LANG_JP - /// - /// このRectを指定の量だけ膨らませる - /// - /// 対象の矩形 - /// 水平方向の膨張量 - /// 垂直方向の膨張量 - /// -#else /// /// Creates and returns an inflated copy of the specified Rect structure. /// @@ -546,28 +359,18 @@ public void Inflate(Size size) /// The amount to inflate this Rectangle horizontally. /// The amount to inflate this Rectangle vertically. /// -#endif public static Rect Inflate(Rect rect, int x, int y) { rect.Inflate(x, y); return rect; } -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Determines the Rect structure that represents the intersection of two rectangles. /// /// A rectangle to intersect. /// A rectangle to intersect. /// -#endif public static Rect Intersect(Rect a, Rect b) { var x1 = Math.Max(a.X, b.X); @@ -580,37 +383,21 @@ public static Rect Intersect(Rect a, Rect b) return Empty; } -#if LANG_JP - /// - /// 2 つの矩形の交差部分を表す矩形を取得する - /// - /// - /// -#else /// /// Determines the Rect structure that represents the intersection of two rectangles. /// /// A rectangle to intersect. /// -#endif public readonly Rect Intersect(Rect rect) { return Intersect(this, rect); } -#if LANG_JP - /// - /// 指定した矩形がこの矩形と交差するかどうか判定する - /// - /// 矩形 - /// -#else /// /// Determines if this rectangle intersects with rect. /// /// Rectangle /// -#endif public readonly bool IntersectsWith(Rect rect) { return @@ -620,39 +407,22 @@ public readonly bool IntersectsWith(Rect rect) (Y + Height > rect.Y); } -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// -#else /// /// Gets a Rect structure that contains the union of two Rect structures. /// /// A rectangle to union. /// -#endif public readonly Rect Union(Rect rect) { return Union(this, rect); } - -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else + /// /// Gets a Rect structure that contains the union of two Rect structures. /// /// A rectangle to union. /// A rectangle to union. /// -#endif public static Rect Union(Rect a, Rect b) { var x1 = Math.Min(a.X, b.X); @@ -695,6 +465,5 @@ public override readonly string ToString() } #endregion - } } \ No newline at end of file diff --git a/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs b/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs index 33f2c44d7..4065ac50f 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Rect2d.cs @@ -13,8 +13,6 @@ namespace OpenCvSharp [StructLayout(LayoutKind.Sequential)] public struct Rect2d : IEquatable { - #region Field - /// /// /// @@ -35,19 +33,11 @@ public struct Rect2d : IEquatable /// public double Height; -#if LANG_JP - /// - /// プロパティを初期化しない状態の Rect2d 構造体を表します。 - /// -#else /// /// Represents a Rect2d structure with its properties left uninitialized. /// -#endif public static readonly Rect2d Empty; - #endregion - /// /// Constructor /// @@ -105,41 +95,23 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott #region == / != -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two Rect2d objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(Rect2d lhs, Rect2d rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two Rect2d objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(Rect2d lhs, Rect2d rhs) { return !lhs.Equals(rhs); @@ -149,21 +121,12 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott #region + / - -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else /// /// Shifts rectangle by a certain offset /// /// /// /// -#endif public static Rect2d operator +(Rect2d rect, Point2d pt) => rect.Add(pt); /// @@ -173,21 +136,12 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott /// public readonly Rect2d Add(Point2d pt) => new (X + pt.X, Y + pt.Y, Width, Height); -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else /// /// Shifts rectangle by a certain offset /// /// /// /// -#endif public static Rect2d operator -(Rect2d rect, Point2d pt) => rect.Subtract(pt); /// @@ -197,21 +151,12 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott /// public readonly Rect2d Subtract(Point2d pt) => new(X - pt.X, Y - pt.Y, Width, Height); -#if LANG_JP - /// - /// 指定したサイズ応じて、矩形を膨張または縮小する - /// - /// - /// - /// -#else /// /// Expands or shrinks rectangle by a certain amount /// /// /// /// -#endif public static Rect2d operator +(Rect2d rect, Size2d size) { return new (rect.X, rect.Y, rect.Width + size.Width, rect.Height + size.Height); @@ -224,21 +169,12 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott /// public readonly Rect2d Add(Size2d size) => new(X, Y, Width + size.Width, Height + size.Height); -#if LANG_JP - /// - /// 指定したサイズ応じて、矩形を膨張または縮小する - /// - /// - /// - /// -#else /// /// Expands or shrinks rectangle by a certain amount /// /// /// /// -#endif public static Rect2d operator -(Rect2d rect, Size2d size) { return new (rect.X, rect.Y, rect.Width - size.Width, rect.Height - size.Height); @@ -255,42 +191,24 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott #region & / | -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Determines the Rect2d structure that represents the intersection of two rectangles. /// /// A rectangle to intersect. /// A rectangle to intersect. /// -#endif [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect2d operator &(Rect2d a, Rect2d b) { return Intersect(a, b); } -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Gets a Rect2d structure that contains the union of two Rect2d structures. /// /// A rectangle to union. /// A rectangle to union. /// -#endif [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect2d operator |(Rect2d a, Rect2d b) { @@ -302,91 +220,54 @@ public static Rect2d FromLTRB(double left, double top, double right, double bott #endregion #region Properties -#if LANG_JP - /// - /// 上端のy座標 - /// -#else + /// /// Gets the y-coordinate of the top edge of this Rect2d structure. /// -#endif public double Top { - get { return Y; } - set { Y = value; } + get => Y; + set => Y = value; } -#if LANG_JP - /// - /// 下端のy座標 (Y + Height) - /// -#else + /// /// Gets the y-coordinate that is the sum of the Y and Height property values of this Rect2d structure. /// -#endif - public double Bottom - { - get { return Y + Height; } - } -#if LANG_JP - /// - /// 左端のx座標 - /// -#else + public double Bottom => Y + Height; + /// /// Gets the x-coordinate of the left edge of this Rect2d structure. /// -#endif public double Left { - get { return X; } - set { X = value; } + get => X; + set => X = value; } -#if LANG_JP - /// - /// 右端のx座標 (X + Width) - /// -#else + /// /// Gets the x-coordinate that is the sum of X and Width property values of this Rect2d structure. /// -#endif - public double Right - { - get { return X + Width; } - } + public double Right => X + Width; -#if LANG_JP - /// - /// 矩形の左上頂点の位置 [Point2d(X, Y)] - /// -#else /// /// Coordinate of the left-most rectangle corner [Point2d(X, Y)] /// -#endif public Point2d Location { - get { return new Point2d(X, Y); } + get => new (X, Y); set { X = value.X; Y = value.Y; } } -#if LANG_JP - /// - /// 矩形の大きさ [CvSize(Width, Height)] - /// -#else + /// /// Size of the rectangle [CvSize(Width, Height)] /// -#endif public Size2d Size { - get { return new Size2d(Width, Height); } + get => new (Width, Height); set { Width = value.Width; @@ -394,32 +275,16 @@ public Size2d Size } } -#if LANG_JP - /// - /// 左上の頂点 - /// -#else /// /// Coordinate of the left-most rectangle corner [Point2d(X, Y)] /// -#endif - public Point2d TopLeft - { - get { return new Point2d(X, Y); } - } -#if LANG_JP - /// - /// 右下の頂点 - /// -#else + public Point2d TopLeft => new (X, Y); + /// /// Coordinate of the right-most rectangle corner [Point2d(X+Width, Y+Height)] /// -#endif - public Point2d BottomRight - { - get { return new Point2d(X + Width, Y + Height); } - } + public Point2d BottomRight => new (X + Width, Y + Height); + #endregion #region Methods @@ -430,60 +295,35 @@ public Point2d BottomRight /// public readonly Rect ToRect() { - return new Rect((int) X, (int) Y, (int) Width, (int) Height); + return new ((int) X, (int) Y, (int) Width, (int) Height); } -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// x座標 - /// y座標 - /// -#else /// /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. /// /// x-coordinate of the point /// y-coordinate of the point /// -#endif public readonly bool Contains(double x, double y) { return (X <= x && Y <= y && X + Width > x && Y + Height > y); } -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// 点 - /// -#else /// /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. /// /// point /// -#endif public readonly bool Contains(Point2d pt) { return Contains(pt.X, pt.Y); } -#if LANG_JP - /// - /// 指定した矩形がこの矩形に含まれているかどうかを判断する - /// - /// 矩形 - /// -#else /// /// Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle. /// /// rectangle /// -#endif public readonly bool Contains(Rect2d rect) { return X <= rect.X && @@ -491,20 +331,12 @@ public readonly bool Contains(Rect2d rect) Y <= rect.Y && (rect.Y + rect.Height) <= (Y + Height); } - -#if LANG_JP - /// - /// このRect2dを指定の量だけ膨らませる - /// - /// 水平方向の膨張量 - /// 垂直方向の膨張量 -#else + /// /// Inflates this Rect by the specified amount. /// /// The amount to inflate this Rectangle horizontally. /// The amount to inflate this Rectangle vertically. -#endif public void Inflate(double width, double height) { X -= width; @@ -513,31 +345,15 @@ public void Inflate(double width, double height) Height += (2 * height); } -#if LANG_JP - /// - /// このRect2dを指定の量だけ膨らませる - /// - /// この四角形の膨張量 -#else /// /// Inflates this Rect by the specified amount. /// /// The amount to inflate this rectangle. -#endif public void Inflate(Size2d size) { Inflate(size.Width, size.Height); } -#if LANG_JP - /// - /// このRect2dを指定の量だけ膨らませる - /// - /// 対象の矩形 - /// 水平方向の膨張量 - /// 垂直方向の膨張量 - /// -#else /// /// Creates and returns an inflated copy of the specified Rect2d structure. /// @@ -545,28 +361,18 @@ public void Inflate(Size2d size) /// The amount to inflate this Rectangle horizontally. /// The amount to inflate this Rectangle vertically. /// -#endif public static Rect Inflate(Rect rect, int x, int y) { rect.Inflate(x, y); return rect; } -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Determines the Rect2d structure that represents the intersection of two rectangles. /// /// A rectangle to intersect. /// A rectangle to intersect. /// -#endif public static Rect2d Intersect(Rect2d a, Rect2d b) { var x1 = Math.Max(a.X, b.X); @@ -579,37 +385,21 @@ public static Rect2d Intersect(Rect2d a, Rect2d b) return Empty; } -#if LANG_JP - /// - /// 2 つの矩形の交差部分を表す矩形を取得する - /// - /// - /// -#else /// /// Determines the Rect2d structure that represents the intersection of two rectangles. /// /// A rectangle to intersect. /// -#endif public readonly Rect2d Intersect(Rect2d rect) { return Intersect(this, rect); } -#if LANG_JP - /// - /// 指定した矩形がこの矩形と交差するかどうか判定する - /// - /// 矩形 - /// -#else /// /// Determines if this rectangle intersects with rect. /// /// Rectangle /// -#endif public readonly bool IntersectsWith(Rect2d rect) { return @@ -619,39 +409,22 @@ public readonly bool IntersectsWith(Rect2d rect) (Y + Height > rect.Y); } -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// -#else /// /// Gets a Rect2d structure that contains the union of two Rect2d structures. /// /// A rectangle to union. /// -#endif public readonly Rect2d Union(Rect2d rect) { return Union(this, rect); } -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Gets a Rect2d structure that contains the union of two Rect2d structures. /// /// A rectangle to union. /// A rectangle to union. /// -#endif public static Rect2d Union(Rect2d a, Rect2d b) { var x1 = Math.Min(a.X, b.X); diff --git a/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs b/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs index 0c8f8180a..91e0ad5b0 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Rect2f.cs @@ -2,53 +2,28 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; -#pragma warning disable CA1051 - namespace OpenCvSharp { /// - /// + /// A rectangle with float type coordinates in 2D space /// [Serializable] [StructLayout(LayoutKind.Sequential)] // ReSharper disable once InconsistentNaming public struct Rect2f : IEquatable { - #region Field - - /// - /// - /// +#pragma warning disable 1591 public float X; - - /// - /// - /// public float Y; - - /// - /// - /// public float Width; - - /// - /// - /// public float Height; +#pragma warning restore 1591 -#if LANG_JP - /// - /// プロパティを初期化しない状態の Rect2f 構造体を表します。 - /// -#else /// /// Represents a Rect2f structure with its properties left uninitialized. /// -#endif public static readonly Rect2f Empty; - #endregion - /// /// Constructor /// @@ -106,41 +81,23 @@ public static Rect2f FromLTRB(float left, float top, float right, float bottom) #region == / != -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two Rect2f objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(Rect2f lhs, Rect2f rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two Rect2f objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(Rect2f lhs, Rect2f rhs) { return !lhs.Equals(rhs); @@ -149,20 +106,12 @@ public static Rect2f FromLTRB(float left, float top, float right, float bottom) #endregion #region + / - -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else + /// /// Shifts rectangle by a certain offset /// /// /// -#endif public readonly Rect2f Add(Point2f pt) => new (X + pt.X, Y + pt.Y, Width, Height); /// @@ -173,20 +122,11 @@ public static Rect2f FromLTRB(float left, float top, float right, float bottom) /// public static Rect2f operator +(Rect2f rect, Point2f pt) => rect.Add(pt); -#if LANG_JP - /// - /// あるオフセットで矩形を移動させる - /// - /// - /// - /// -#else /// /// Shifts rectangle by a certain offset /// /// /// -#endif public readonly Rect2f Subtract(Point2f pt) => new (X - pt.X, Y - pt.Y, Width, Height); /// @@ -197,19 +137,11 @@ public static Rect2f FromLTRB(float left, float top, float right, float bottom) /// public static Rect2f operator -(Rect2f rect, Point2f pt) => rect.Subtract(pt); -#if LANG_JP - /// - /// 指定したサイズに応じて、矩形を膨張または縮小する - /// - /// - /// -#else /// /// Expands or shrinks rectangle by a certain amount /// /// /// -#endif public readonly Rect2f Add(Size2f size) => new (X, Y, Width + size.Width, Height + size.Height); /// @@ -220,19 +152,11 @@ public static Rect2f FromLTRB(float left, float top, float right, float bottom) /// public static Rect2f operator +(Rect2f rect, Size2f size) => rect.Add(size); -#if LANG_JP - /// - /// 指定したサイズに応じて、矩形を膨張または縮小する - /// - /// - /// -#else /// /// Expands or shrinks rectangle by a certain amount /// /// /// -#endif public readonly Rect2f Subtract(Size2f size) => new (X, Y, Width - size.Width, Height - size.Height); /// @@ -247,42 +171,24 @@ public static Rect2f FromLTRB(float left, float top, float right, float bottom) #region & / | -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Determines the Rect2f structure that represents the intersection of two rectangles. /// /// A rectangle to intersect. /// A rectangle to intersect. /// -#endif [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect2f operator &(Rect2f a, Rect2f b) { return Intersect(a, b); } -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Gets a Rect2f structure that contains the union of two Rect2f structures. /// /// A rectangle to union. /// A rectangle to union. /// -#endif [SuppressMessage("Microsoft.Design", "CA2225: Operator overloads have named alternates")] public static Rect2f operator |(Rect2f a, Rect2f b) { @@ -294,76 +200,41 @@ public static Rect2f FromLTRB(float left, float top, float right, float bottom) #endregion #region Properties -#if LANG_JP - /// - /// 上端のy座標 - /// -#else + /// /// Gets the y-coordinate of the top edge of this Rect2f structure. /// -#endif public float Top { - get { return Y; } - set { Y = value; } + get => Y; + set => Y = value; } -#if LANG_JP - /// - /// 下端のy座標 (Y + Height) - /// -#else /// /// Gets the y-coordinate that is the sum of the Y and Height property values of this Rect2f structure. /// -#endif - public float Bottom - { - get { return Y + Height; } - } + public float Bottom => Y + Height; -#if LANG_JP - /// - /// 左端のx座標 - /// -#else /// /// Gets the x-coordinate of the left edge of this Rect2f structure. /// -#endif public float Left { - get { return X; } - set { X = value; } + get => X; + set => X = value; } -#if LANG_JP - /// - /// 右端のx座標 (X + Width) - /// -#else /// /// Gets the x-coordinate that is the sum of X and Width property values of this Rect2f structure. /// -#endif - public float Right - { - get { return X + Width; } - } + public float Right => X + Width; -#if LANG_JP - /// - /// 矩形の左上頂点の位置 [Point2f(X, Y)] - /// -#else /// /// Coordinate of the left-most rectangle corner [Point2f(X, Y)] /// -#endif public Point2f Location { - get { return new Point2f(X, Y); } + get => new (X, Y); set { X = value.X; @@ -371,18 +242,12 @@ public Point2f Location } } -#if LANG_JP - /// - /// 矩形の大きさ [CvSize(Width, Height)] - /// -#else /// /// Size of the rectangle [CvSize(Width, Height)] /// -#endif public Size2f Size { - get { return new Size2f(Width, Height); } + get => new (Width, Height); set { Width = value.Width; @@ -390,88 +255,46 @@ public Size2f Size } } -#if LANG_JP - /// - /// 左上の頂点 - /// -#else /// /// Coordinate of the left-most rectangle corner [Point2f(X, Y)] /// -#endif - public Point2f TopLeft - { - get { return new Point2f(X, Y); } - } + public Point2f TopLeft => new (X, Y); -#if LANG_JP - /// - /// 右下の頂点 - /// -#else /// /// Coordinate of the right-most rectangle corner [Point2f(X+Width, Y+Height)] /// -#endif - public Point2f BottomRight - { - get { return new Point2f(X + Width, Y + Height); } - } + public Point2f BottomRight => new (X + Width, Y + Height); + #endregion #region Methods -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// x座標 - /// y座標 - /// -#else /// /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. /// /// x-coordinate of the point /// y-coordinate of the point /// -#endif public readonly bool Contains(float x, float y) { return (X <= x && Y <= y && X + Width > x && Y + Height > y); } -#if LANG_JP - /// - /// 指定した点がこの矩形に含まれているかどうかを判断する - /// - /// 点 - /// -#else /// /// Determines if the specified point is contained within the rectangular region defined by this Rectangle. /// /// point /// -#endif public readonly bool Contains(Point2f pt) { return Contains(pt.X, pt.Y); } -#if LANG_JP - /// - /// 指定した矩形がこの矩形に含まれているかどうかを判断する - /// - /// 矩形 - /// -#else /// /// Determines if the specified rectangle is contained within the rectangular region defined by this Rectangle. /// /// rectangle /// -#endif public readonly bool Contains(Rect2f rect) { return X <= rect.X && @@ -480,19 +303,11 @@ public readonly bool Contains(Rect2f rect) (rect.Y + rect.Height) <= (Y + Height); } -#if LANG_JP - /// - /// このRect2fを指定の量だけ膨らませる - /// - /// 水平方向の膨張量 - /// 垂直方向の膨張量 -#else /// /// Inflates this Rect by the specified amount. /// /// The amount to inflate this Rectangle horizontally. /// The amount to inflate this Rectangle vertically. -#endif public void Inflate(float width, float height) { X -= width; @@ -501,31 +316,15 @@ public void Inflate(float width, float height) Height += (2 * height); } -#if LANG_JP - /// - /// このRect2fを指定の量だけ膨らませる - /// - /// この四角形の膨張量 -#else /// /// Inflates this Rect by the specified amount. /// /// The amount to inflate this rectangle. -#endif public void Inflate(Size2f size) { Inflate(size.Width, size.Height); } -#if LANG_JP - /// - /// このRect2fを指定の量だけ膨らませる - /// - /// 対象の矩形 - /// 水平方向の膨張量 - /// 垂直方向の膨張量 - /// -#else /// /// Creates and returns an inflated copy of the specified Rect2f structure. /// @@ -533,28 +332,18 @@ public void Inflate(Size2f size) /// The amount to inflate this Rectangle horizontally. /// The amount to inflate this Rectangle vertically. /// -#endif public static Rect Inflate(Rect rect, int x, int y) { rect.Inflate(x, y); return rect; } -#if LANG_JP - /// - /// 2つの矩形の交差部分を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Determines the Rect2f structure that represents the intersection of two rectangles. /// /// A rectangle to intersect. /// A rectangle to intersect. /// -#endif public static Rect2f Intersect(Rect2f a, Rect2f b) { var x1 = Math.Max(a.X, b.X); @@ -567,37 +356,21 @@ public static Rect2f Intersect(Rect2f a, Rect2f b) return Empty; } -#if LANG_JP - /// - /// 2 つの矩形の交差部分を表す矩形を取得する - /// - /// - /// -#else /// /// Determines the Rect2f structure that represents the intersection of two rectangles. /// /// A rectangle to intersect. /// -#endif public readonly Rect2f Intersect(Rect2f rect) { return Intersect(this, rect); } -#if LANG_JP - /// - /// 指定した矩形がこの矩形と交差するかどうか判定する - /// - /// 矩形 - /// -#else /// /// Determines if this rectangle intersects with rect. /// /// Rectangle /// -#endif public readonly bool IntersectsWith(Rect2f rect) { return @@ -607,39 +380,22 @@ public readonly bool IntersectsWith(Rect2f rect) (Y + Height > rect.Y); } -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// -#else /// /// Gets a Rect2f structure that contains the union of two Rect2f structures. /// /// A rectangle to union. /// -#endif public readonly Rect2f Union(Rect2f rect) { return Union(this, rect); } -#if LANG_JP - /// - /// 2つの矩形の和集合を表す矩形を取得する - /// - /// - /// - /// -#else /// /// Gets a Rect2f structure that contains the union of two Rect2f structures. /// /// A rectangle to union. /// A rectangle to union. /// -#endif public static Rect2f Union(Rect2f a, Rect2f b) { var x1 = Math.Min(a.X, b.X); @@ -682,6 +438,5 @@ public override readonly string ToString() } #endregion - } } diff --git a/src/OpenCvSharp/Modules/core/Struct/Size.cs b/src/OpenCvSharp/Modules/core/Struct/Size.cs index a599b2c03..a4cdd77a7 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Size.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Size.cs @@ -1,8 +1,6 @@ using System; using System.Runtime.InteropServices; -#pragma warning disable CA1051 - namespace OpenCvSharp { /// @@ -51,41 +49,23 @@ public Size(double width, double height) #region Operators -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(Size lhs, Size rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(Size lhs, Size rhs) { return !lhs.Equals(rhs); diff --git a/src/OpenCvSharp/Modules/core/Struct/Size2d.cs b/src/OpenCvSharp/Modules/core/Struct/Size2d.cs index fee5e1841..b6ea96303 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Size2d.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Size2d.cs @@ -46,41 +46,23 @@ public Size2d(double width, double height) #region Operators -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(Size2d lhs, Size2d rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(Size2d lhs, Size2d rhs) { return !lhs.Equals(rhs); diff --git a/src/OpenCvSharp/Modules/core/Struct/Size2f.cs b/src/OpenCvSharp/Modules/core/Struct/Size2f.cs index eadceb02e..c2a91533a 100644 --- a/src/OpenCvSharp/Modules/core/Struct/Size2f.cs +++ b/src/OpenCvSharp/Modules/core/Struct/Size2f.cs @@ -47,41 +47,23 @@ public Size2f(double width, double height) #region Operators -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(Size2f lhs, Size2f rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(Size2f lhs, Size2f rhs) { return !lhs.Equals(rhs); diff --git a/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs b/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs index 13049365e..31edf3bac 100644 --- a/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs +++ b/src/OpenCvSharp/Modules/core/Struct/TermCriteria.cs @@ -12,7 +12,7 @@ namespace OpenCvSharp /// /// the type of termination criteria: COUNT, EPS or COUNT + EPS /// - public readonly CriteriaType Type; + public readonly CriteriaTypes Type; /// /// the maximum number of iterations/elements @@ -30,7 +30,7 @@ namespace OpenCvSharp /// /// /// - public TermCriteria(CriteriaType type, int maxCount, double epsilon) + public TermCriteria(CriteriaTypes type, int maxCount, double epsilon) { Type = type; MaxCount = maxCount; @@ -45,7 +45,7 @@ public TermCriteria(CriteriaType type, int maxCount, double epsilon) public static TermCriteria Both(int maxCount, double epsilon) { return new ( - type: CriteriaType.Count | CriteriaType.Eps, + type: CriteriaTypes.Count | CriteriaTypes.Eps, maxCount: maxCount, epsilon: epsilon); } diff --git a/src/OpenCvSharp/Modules/cuda/GpuMat.cs b/src/OpenCvSharp/Modules/cuda/GpuMat.cs index bb6e931ef..c7760e775 100644 --- a/src/OpenCvSharp/Modules/cuda/GpuMat.cs +++ b/src/OpenCvSharp/Modules/cuda/GpuMat.cs @@ -8,30 +8,17 @@ namespace OpenCvSharp.Cuda { -#if LANG_JP - /// - /// 参照カウンタを持つ,GPU メモリ用の基底ストレージクラス. - /// -#else /// /// Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat. /// -#endif public class GpuMat : DisposableCvObject { -#region Init and Disposal + #region Init and Disposal -#if LANG_JP - /// - /// OpenCVネイティブの cv::gpu::GpuMat* ポインタから初期化 - /// - /// -#else /// /// Creates from native cv::gpu::GpuMat* pointer /// /// -#endif public GpuMat(IntPtr ptr) { ThrowIfNotAvailable(); @@ -40,15 +27,9 @@ public GpuMat(IntPtr ptr) this.ptr = ptr; } -#if LANG_JP - /// - /// 空の行列として初期化 - /// -#else /// /// Creates empty GpuMat /// -#endif public GpuMat() { ThrowIfNotAvailable(); @@ -57,15 +38,6 @@ public GpuMat() throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else /// /// constructs 2D matrix of the specified size and type /// @@ -73,7 +45,6 @@ public GpuMat() /// Number of columns in a 2D array. /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif public GpuMat(int rows, int cols, MatType type) { ThrowIfNotAvailable(); @@ -86,24 +57,6 @@ public GpuMat(int rows, int cols, MatType type) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -117,7 +70,6 @@ public GpuMat(int rows, int cols, MatType type) /// The external data is not automatically deallocated, so you should take care of it. /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif public GpuMat(int rows, int cols, MatType type, IntPtr data, long step) { ThrowIfNotAvailable(); @@ -130,21 +82,12 @@ public GpuMat(int rows, int cols, MatType type, IntPtr data, long step) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列として初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. -#else /// /// constructs 2D matrix of the specified size and type /// /// 2D array size: Size(cols, rows) /// Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, /// or MatType.CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. -#endif public GpuMat(Size size, MatType type) { ThrowIfNotAvailable(); @@ -153,23 +96,6 @@ public GpuMat(Size size, MatType type) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 利用者が別に確保したデータで初期化 - /// - /// 2次元配列のサイズ: Size(cols, rows) - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// ユーザデータへのポインタ. data と step パラメータを引数にとる - /// 行列コンストラクタは,行列データ領域を確保しません.代わりに,指定のデータを指し示す - /// 行列ヘッダを初期化します.つまり,データのコピーは行われません. - /// この処理は,非常に効率的で,OpenCV の関数を利用して外部データを処理することができます. - /// 外部データが自動的に解放されることはありませんので,ユーザが解放する必要があります. - /// 行列の各行が占めるバイト数を指定できます. - /// この値は,各行の終端にパディングバイトが存在すれば,それも含みます. - /// このパラメータが指定されない場合,パディングは存在しないとみなされ, - /// 実際の step は cols*elemSize() として計算されます. -#else /// /// constructor for matrix headers pointing to user-allocated data /// @@ -182,7 +108,6 @@ public GpuMat(Size size, MatType type) /// The external data is not automatically deallocated, so you should take care of it. /// Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. /// If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() . -#endif public GpuMat(Size size, MatType type, IntPtr data, long step = 0) { ThrowIfNotAvailable(); @@ -191,17 +116,10 @@ public GpuMat(Size size, MatType type, IntPtr data, long step = 0) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 他の行列のから初期化 - /// - /// 作成された行列に全体的割り当てられる配列. -#else /// /// creates a matrix for other matrix /// /// Array that (as a whole) is assigned to the constructed matrix. -#endif public GpuMat(Mat m) { ThrowIfNotAvailable(); @@ -213,17 +131,10 @@ public GpuMat(Mat m) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 他のGpuMat初期化 - /// - /// 作成された行列に全体的割り当てられる配列. -#else /// /// creates a matrix for other matrix /// /// GpuMat that (as a whole) is assigned to the constructed matrix. -#endif public GpuMat(GpuMat m) { ThrowIfNotAvailable(); @@ -235,17 +146,6 @@ public GpuMat(GpuMat m) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2次元配列における行数. - /// 2次元配列における列数. - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constucts 2D matrix and fills it with the specified Scalar value. /// @@ -255,7 +155,6 @@ public GpuMat(GpuMat m) /// or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public GpuMat(int rows, int cols, MatType type, Scalar s) { ThrowIfNotAvailable(); @@ -268,16 +167,6 @@ public GpuMat(int rows, int cols, MatType type, Scalar s) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 指定したサイズ・型の2次元の行列で、要素をスカラー値で埋めて初期化 - /// - /// 2 次元配列のサイズ: Size(cols, rows) - /// 配列の型.1-4 チャンネルの行列を作成するには MatType.CV_8UC1, ..., CV_64FC4 を, - /// マルチチャンネルの行列を作成するには,MatType.CV_8UC(n), ..., CV_64FC(n) を利用してください. - /// 各行列要素を初期化するオプション値.初期化の後ですべての行列要素を特定の値にセットするには, - /// コンストラクタの後で,SetTo(Scalar value) メソッドを利用してください. -#else /// /// constucts 2D matrix and fills it with the specified Scalar value. /// @@ -286,7 +175,6 @@ public GpuMat(int rows, int cols, MatType type, Scalar s) /// or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices. /// An optional value to initialize each matrix element with. /// To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method . -#endif public GpuMat(Size size, MatType type, Scalar s) { ThrowIfNotAvailable(); @@ -295,14 +183,6 @@ public GpuMat(Size size, MatType type, Scalar s) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// 扱われる 行列の行の範囲.すべての行を扱う場合は,Range.All を利用してください. - /// 扱われる 行列の列の範囲.すべての列を扱う場合は,Range.All を利用してください. -#else /// /// creates a matrix header for a part of the bigger matrix /// @@ -310,7 +190,6 @@ public GpuMat(Size size, MatType type, Scalar s) /// Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. /// Use Range.All to take all the rows. /// Range of the m columns to take. Use Range.All to take all the columns. -#endif public GpuMat(GpuMat m, Range rowRange, Range colRange) { ThrowIfNotAvailable(); @@ -322,19 +201,11 @@ public GpuMat(GpuMat m, Range rowRange, Range colRange) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// 他の行列の部分行列として初期化 - /// - /// 作成された行列に(全体的,部分的に)割り当てられる配列. - /// 元の行列からくりぬかれる範囲. ROI[Region of interest]. -#else /// /// creates a matrix header for a part of the bigger matrix /// /// Array that (as a whole or partly) is assigned to the constructed matrix.. /// Region of interest. -#endif public GpuMat(GpuMat m, Rect roi) { ThrowIfNotAvailable(); @@ -346,15 +217,9 @@ public GpuMat(GpuMat m, Rect roi) throw new OpenCvSharpException(); } -#if LANG_JP - /// - /// リソースの解放 - /// -#else /// /// Clean up any resources being used. /// -#endif public void Release() { Dispose(); @@ -369,9 +234,9 @@ protected override void DisposeUnmanaged() base.DisposeUnmanaged(); } -#endregion + #endregion -#region Cast + #region Cast /// /// converts header to GpuMat @@ -402,9 +267,10 @@ public static implicit operator Mat(GpuMat gpumat) GC.KeepAlive(gpumat); return new Mat(ret); } -#endregion -#region Properties + #endregion + + #region Properties /// /// includes several bit-fields: diff --git a/src/OpenCvSharp/Modules/cuda/Stream.cs b/src/OpenCvSharp/Modules/cuda/Stream.cs index b6c402483..89bc2b432 100644 --- a/src/OpenCvSharp/Modules/cuda/Stream.cs +++ b/src/OpenCvSharp/Modules/cuda/Stream.cs @@ -17,34 +17,21 @@ namespace OpenCvSharp.Cuda [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void StreamCallbackInternal(IntPtr stream, int status, IntPtr userData); -#if LANG_JP /// /// Encapculates Cuda Stream. Provides interface for async coping. /// -#else - /// - /// Encapculates Cuda Stream. Provides interface for async coping. - /// -#endif public sealed class Stream : DisposableGpuObject { private StreamCallbackInternal callbackInternal; private GCHandle callbackHandle; private GCHandle userDataHandle; -#region Init and Disposal + #region Init and Disposal -#if LANG_JP - /// - /// OpenCVネイティブの cv::gpu::Stream* ポインタから初期化 - /// - /// -#else /// /// Creates from native cv::gpu::Stream* pointer /// /// -#endif public Stream(IntPtr ptr) { ThrowIfNotAvailable(); @@ -75,15 +62,9 @@ public Stream(Stream m) GC.KeepAlive(m); } -#if LANG_JP - /// - /// リソースの解放 - /// -#else /// /// Clean up any resources being used. /// -#endif public void Release() { Dispose(); @@ -102,7 +83,7 @@ protected override void DisposeUnmanaged() base.DisposeUnmanaged(); } -#endregion + #endregion /// /// Empty stream diff --git a/src/OpenCvSharp/Modules/features2d/AKAZE.cs b/src/OpenCvSharp/Modules/features2d/AKAZE.cs index a5ca4b027..e4515fbcc 100644 --- a/src/OpenCvSharp/Modules/features2d/AKAZE.cs +++ b/src/OpenCvSharp/Modules/features2d/AKAZE.cs @@ -7,11 +7,6 @@ namespace OpenCvSharp { // ReSharper disable once InconsistentNaming -#if LANG_JP - /// - /// AKAZE 実装 - /// -#else /// /// Class implementing the AKAZE keypoint detector and descriptor extractor, /// described in @cite ANB13 @@ -23,7 +18,6 @@ namespace OpenCvSharp /// Spaces. Pablo F. Alcantarilla, Jesús Nuevo and Adrien Bartoli. /// In British Machine Vision Conference (BMVC), Bristol, UK, September 2013. /// -#endif // ReSharper disable once InconsistentNaming public class AKAZE : Feature2D { diff --git a/src/OpenCvSharp/Modules/features2d/DenseFeatureDetector.cs b/src/OpenCvSharp/Modules/features2d/DenseFeatureDetector.cs index 89190ca8a..5fcb72480 100644 --- a/src/OpenCvSharp/Modules/features2d/DenseFeatureDetector.cs +++ b/src/OpenCvSharp/Modules/features2d/DenseFeatureDetector.cs @@ -65,15 +65,6 @@ internal DenseFeatureDetector(IntPtr rawPtr) return new DenseFeatureDetector(ptrObj); } -#if LANG_JP - /// - /// リソースの解放 - /// - /// - /// trueの場合は、このメソッドがユーザコードから直接が呼ばれたことを示す。マネージ・アンマネージ双方のリソースが解放される。 - /// falseの場合は、このメソッドはランタイムからファイナライザによって呼ばれ、もうほかのオブジェクトから参照されていないことを示す。アンマネージリソースのみ解放される。 - /// -#else /// /// Releases the resources /// @@ -81,7 +72,6 @@ internal DenseFeatureDetector(IntPtr rawPtr) /// If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. /// If false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed. /// -#endif protected override void Dispose(bool disposing) { if (!disposed) @@ -112,7 +102,8 @@ protected override void Dispose(bool disposing) } } } -#endregion + + #endregion /// /// Pointer to algorithm information (cv::AlgorithmInfo*) diff --git a/src/OpenCvSharp/Modules/features2d/MSER.cs b/src/OpenCvSharp/Modules/features2d/MSER.cs index 4ea54fb65..21ba447bf 100644 --- a/src/OpenCvSharp/Modules/features2d/MSER.cs +++ b/src/OpenCvSharp/Modules/features2d/MSER.cs @@ -4,17 +4,11 @@ namespace OpenCvSharp { -// ReSharper disable once InconsistentNaming + // ReSharper disable once InconsistentNaming -#if LANG_JP - /// - /// MSER (Maximal Stable Extremal Regions) 抽出機 - /// -#else /// /// Maximal Stable Extremal Regions class /// -#endif // ReSharper disable once InconsistentNaming public class MSER : Feature2D { diff --git a/src/OpenCvSharp/Modules/flann/FlannCentersInit.cs b/src/OpenCvSharp/Modules/flann/FlannCentersInit.cs index 606392607..b3d68e935 100644 --- a/src/OpenCvSharp/Modules/flann/FlannCentersInit.cs +++ b/src/OpenCvSharp/Modules/flann/FlannCentersInit.cs @@ -1,57 +1,29 @@ // ReSharper disable InconsistentNaming // ReSharper disable CommentTypo + namespace OpenCvSharp.Flann { -#if LANG_JP - /// - /// k-means クラスタリングの初期中心を選択するアルゴリズム. - /// -#else /// /// The algorithm to use for selecting the initial centers when performing a k-means clustering step. /// -#endif public enum FlannCentersInit { -#if LANG_JP - /// - /// ランダムに初期クラスタ中心を選択 - /// [flann_centers_init_t::CENTERS_RANDOM] - /// -#else /// /// picks the initial cluster centers randomly /// [flann_centers_init_t::CENTERS_RANDOM] /// -#endif Random = 0, -#if LANG_JP - /// - /// Gonzalesのアルゴリズムを用いて初期クラスタ中心を選択 - /// [flann_centers_init_t::CENTERS_GONZALES] - /// -#else /// /// picks the initial centers using Gonzales’ algorithm /// [flann_centers_init_t::CENTERS_GONZALES] /// -#endif Gonzales = 1, -#if LANG_JP - /// - /// arthur_kmeanspp_2007 で提案されたアルゴリズムを用いて初期クラスタ中心を選択 - /// [flann_centers_init_t::CENTERS_KMEANSPP] - /// -#else /// /// picks the initial centers using the algorithm suggested in [arthur_kmeanspp_2007] /// [flann_centers_init_t::CENTERS_KMEANSPP] /// -#endif KMeansPP = 2 } } - - diff --git a/src/OpenCvSharp/Modules/flann/Index.cs b/src/OpenCvSharp/Modules/flann/Index.cs index baf39d842..2b3d5bd1e 100644 --- a/src/OpenCvSharp/Modules/flann/Index.cs +++ b/src/OpenCvSharp/Modules/flann/Index.cs @@ -3,32 +3,17 @@ namespace OpenCvSharp.Flann { -#if LANG_JP - /// - /// FLANN 最近傍インデックスクラス - /// -#else /// /// The FLANN nearest neighbor index class. /// -#endif public class Index : DisposableCvObject { -#if LANG_JP - /// - /// 与えられたデータセットの最近傍探索インデックスを作成します. - /// - /// インデックス作成対象となる特徴(点)が格納された, CV_32F 型の行列.この行列のサイズは matrix is num _ features x feature _ dimensionality となります - /// params – インデックスパラメータを含む構造体.作成されるインデックスの種類は,このパラメータの種類に依存します - /// -#else /// /// Constructs a nearest neighbor search index for a given dataset. /// /// features – Matrix of type CV _ 32F containing the features(points) to index. The size of the matrix is num _ features x feature _ dimensionality. /// Structure containing the index parameters. The type of index that will be constructed depends on the type of this parameter. /// -#endif public Index(InputArray features, IndexParams @params, FlannDistance distType = FlannDistance.L2) { if (features == null) @@ -55,16 +40,6 @@ protected override void DisposeUnmanaged() base.DisposeUnmanaged(); } -#if LANG_JP - /// - /// 複数のクエリ点に対するk-近傍探索を行います. - /// - /// クエリ点 - /// 求められた最近傍のインデックス - /// 求められた最近傍までの距離 - /// この個数分の最近傍を求めます - /// 探索パラメータ -#else /// /// Performs a K-nearest neighbor search for multiple query points. /// @@ -73,7 +48,6 @@ protected override void DisposeUnmanaged() /// Distances to the nearest neighbors found /// Number of nearest neighbors to search for /// Search parameters -#endif public void KnnSearch(float[] queries, out int[] indices, out float[] dists, int knn, SearchParams @params) { if (queries == null) @@ -96,16 +70,6 @@ public void KnnSearch(float[] queries, out int[] indices, out float[] dists, int GC.KeepAlive(@params); } -#if LANG_JP - /// - /// 複数のクエリ点に対するk-近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します - /// 求められた最近傍のインデックス - /// 求められた最近傍までの距離 - /// この個数分の最近傍を求めます - /// 探索パラメータ -#else /// /// Performs a K-nearest neighbor search for multiple query points. /// @@ -114,7 +78,6 @@ public void KnnSearch(float[] queries, out int[] indices, out float[] dists, int /// Distances to the nearest neighbors found /// Number of nearest neighbors to search for /// Search parameters -#endif public void KnnSearch(Mat queries, Mat indices, Mat dists, int knn, SearchParams @params) { if (queries == null) @@ -137,16 +100,6 @@ public void KnnSearch(Mat queries, Mat indices, Mat dists, int knn, SearchParams GC.KeepAlive(@params); } -#if LANG_JP - /// - /// 複数のクエリ点に対するk-近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します - /// 求められた最近傍のインデックス - /// 求められた最近傍までの距離 - /// この個数分の最近傍を求めます - /// 探索パラメータ -#else /// /// Performs a K-nearest neighbor search for multiple query points. /// @@ -155,7 +108,6 @@ public void KnnSearch(Mat queries, Mat indices, Mat dists, int knn, SearchParams /// Distances to the nearest neighbors found /// Number of nearest neighbors to search for /// Search parameters -#endif public void KnnSearch(Mat queries, out int[] indices, out float[] dists, int knn, SearchParams @params) { if (queries == null) @@ -177,17 +129,6 @@ public void KnnSearch(Mat queries, out int[] indices, out float[] dists, int knn GC.KeepAlive(@params); } -#if LANG_JP - /// - /// 与えられたクエリ点に対するradius 最近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します [入力] - /// 求められた最近傍のインデックス [出力] - /// 求められた最近傍までの距離 [出力] - /// 探索範囲 - /// - /// 探索パラメータ -#else /// /// Performs a radius nearest neighbor search for a given query point. /// @@ -197,7 +138,6 @@ public void KnnSearch(Mat queries, out int[] indices, out float[] dists, int knn /// Number of nearest neighbors to search for /// /// Search parameters -#endif public void RadiusSearch(float[] queries, int[] indices, float[] dists, double radius, int maxResults, SearchParams @params) { if (queries == null) @@ -217,17 +157,6 @@ public void RadiusSearch(float[] queries, int[] indices, float[] dists, double r GC.KeepAlive(@params); } -#if LANG_JP - /// - /// 与えられたクエリ点に対するradius 最近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します [入力] - /// 求められた最近傍のインデックス [出力] - /// 求められた最近傍までの距離 [出力] - /// 探索範囲 - /// - /// 探索パラメータ -#else /// /// Performs a radius nearest neighbor search for a given query point. /// @@ -237,7 +166,6 @@ public void RadiusSearch(float[] queries, int[] indices, float[] dists, double r /// Number of nearest neighbors to search for /// /// Search parameters -#endif public void RadiusSearch(Mat queries, Mat indices, Mat dists, double radius, int maxResults, SearchParams @params) { if (queries == null) @@ -260,17 +188,6 @@ public void RadiusSearch(Mat queries, Mat indices, Mat dists, double radius, int GC.KeepAlive(@params); } -#if LANG_JP - /// - /// 与えられたクエリ点に対するradius 最近傍探索を行います. - /// - /// クエリ点.1行が1つの点を表します [入力] - /// 求められた最近傍のインデックス [出力] - /// 求められた最近傍までの距離 [出力] - /// 探索範囲 - /// - /// 探索パラメータ -#else /// /// Performs a radius nearest neighbor search for a given query point. /// @@ -280,7 +197,6 @@ public void RadiusSearch(Mat queries, Mat indices, Mat dists, double radius, int /// Number of nearest neighbors to search for /// /// Search parameters -#endif public void RadiusSearch(Mat queries, int[] indices, float[] dists, double radius, int maxResults, SearchParams @params) { if (queries == null) @@ -301,17 +217,10 @@ public void RadiusSearch(Mat queries, int[] indices, float[] dists, double radiu GC.KeepAlive(@params); } -#if LANG_JP - /// - /// インデックスをファイルに保存します. - /// - /// インデックスを保存するファイル名 -#else /// /// Saves the index to a file. /// /// The file to save the index to -#endif public void Save(string filename) { if (string.IsNullOrEmpty(filename)) diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/AutotunedIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/AutotunedIndexParams.cs index 2b23cba55..355fa0112 100644 --- a/src/OpenCvSharp/Modules/flann/IndexParams/AutotunedIndexParams.cs +++ b/src/OpenCvSharp/Modules/flann/IndexParams/AutotunedIndexParams.cs @@ -3,30 +3,11 @@ namespace OpenCvSharp.Flann { -#if LANG_JP - /// - /// 階層型 k-means tree で表現されるインデックス. - /// -#else /// /// hierarchical k-means tree. /// -#endif public class AutotunedIndexParams : IndexParams { -#if LANG_JP - /// - /// - /// - /// どれだけ厳密な最近傍を返すかという,最近傍探索の近似の割合を指定する 0から1の間の値.このパラメータが大きくなると,より正確な結果が得られますが,探索時間が長くなります.最適な値は,アプリケーションに依存します - /// 最近傍探索時間に対するインデックスの構築時間の重要度を指定します. - /// その後のインデックス探索時間が高速になるならば,インデックスの構築時間が長くても良いというアプリケーションが存在する一方で,インデックスの探索時間が多少長くなっても,できるだけ高速にインデックスを構築する必要があるアプリケーションもあります - /// これは,(インデックスの構築時間と探索時間)とインデックスの占有メモリとの,トレードオフを指定するのに利用されます. - /// 1より小さい値は消費時間を重要視し,1より大きい値はメモリ使用量を重要視します - /// パラメータの自動設定アルゴリズムにおけるデータ集合の比率を示す,0から1の間の値. - /// 全データ集合を用いてアルゴリズムを実行すると,最も正確な結果が得られますが,巨大なデータ集合に対しては長い計算時間がかかります. - /// このような場合,データをある比率分だけ使うことでアルゴリズムを高速化し,なおかつ,最適なパラメータの良い近似となる結果を得ることができます -#else /// /// /// @@ -40,7 +21,6 @@ public class AutotunedIndexParams : IndexParams /// Is a number between 0 and 1 indicating what fraction of the dataset to use in the automatic parameter configuration algorithm. /// Running the algorithm on the full dataset gives the most accurate results, but for very large datasets can take longer than desired. /// In such case using just a fraction of the data helps speeding up this algorithm while still giving good approximations of the optimum parameters. -#endif public AutotunedIndexParams(float targetPrecision = 0.9f, float buildWeight = 0.01f, float memoryWeight = 0, float sampleFraction = 0.1f) : base(null) { diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/CompositeIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/CompositeIndexParams.cs index 0381c6e24..23a6f5f08 100644 --- a/src/OpenCvSharp/Modules/flann/IndexParams/CompositeIndexParams.cs +++ b/src/OpenCvSharp/Modules/flann/IndexParams/CompositeIndexParams.cs @@ -3,27 +3,11 @@ namespace OpenCvSharp.Flann { -#if LANG_JP - /// - /// ランダム kd-tree と 階層的 k-means tree の組み合わせでインデックスが表現されます. - /// -#else /// /// When using a parameters object of this type the index created combines the randomized kd-trees and the hierarchical k-means tree. /// -#endif public class CompositeIndexParams : IndexParams { -#if LANG_JP - /// - /// - /// - /// 並列な kd-tree の個数.[1..16] の範囲が適切な値です - /// 階層型 k-means tree で利用される branching ファクタ - /// k-means tree を作成する際の,k-means クラスタリングステージでの反復数の上限.ここで -1 は,k-means クラスタリングが収束するまで続けられることを意味します - /// k-means クラスタリングの初期中心を選択するアルゴリズム. - /// このパラメータ(クラスタ境界インデックス)は,階層的 k-means tree の探索方法に影響を与えます. cb_index が0の場合,最も近い中心のクラスタが,次に探索される k-means 領域になります.0より大きい値の場合も,領域サイズが考慮されます -#else /// /// /// @@ -32,7 +16,6 @@ public class CompositeIndexParams : IndexParams /// The maximum number of iterations to use in the k-means clustering stage when building the k-means tree. A value of -1 used here means that the k-means clustering should be iterated until convergence /// The algorithm to use for selecting the initial centers when performing a k-means clustering step. /// This parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When cb_index is zero the next kmeans domain to be explored is choosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain. -#endif public CompositeIndexParams(int trees = 4, int branching = 32, int iterations = 11, FlannCentersInit centersInit = FlannCentersInit.Random, float cbIndex = 0.2f) : base(null) diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/KDTreeIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/KDTreeIndexParams.cs index 57b44cf3c..c77ddb6d4 100644 --- a/src/OpenCvSharp/Modules/flann/IndexParams/KDTreeIndexParams.cs +++ b/src/OpenCvSharp/Modules/flann/IndexParams/KDTreeIndexParams.cs @@ -5,29 +5,16 @@ namespace OpenCvSharp.Flann { -#if LANG_JP - /// - /// ランダム kd-tree の集合でインデックスが表現され,これは並列に探索されます. - /// -#else /// /// When passing an object of this type the index constructed will consist of a set /// of randomized kd-trees which will be searched in parallel. /// -#endif public class KDTreeIndexParams : IndexParams { -#if LANG_JP - /// - /// - /// - /// 並列な kd-tree の個数.[1..16] の範囲が適切な値です -#else /// - /// + /// Constructor /// /// The number of parallel kd-trees to use. Good values are in the range [1..16] -#endif public KDTreeIndexParams(int trees = 4) : base(null) { diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/KMeansIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/KMeansIndexParams.cs index a4e03be13..12edb59a6 100644 --- a/src/OpenCvSharp/Modules/flann/IndexParams/KMeansIndexParams.cs +++ b/src/OpenCvSharp/Modules/flann/IndexParams/KMeansIndexParams.cs @@ -3,34 +3,18 @@ namespace OpenCvSharp.Flann { -#if LANG_JP - /// - /// 階層型 k-means tree でインデックスが表現されます. - /// -#else /// /// When passing an object of this type the index constructed will be a hierarchical k-means tree. /// -#endif public class KMeansIndexParams : IndexParams { -#if LANG_JP - /// - /// - /// - /// 階層型 k-means tree で利用される branching ファクタ - /// k-means tree を作成する際の,k-means クラスタリングステージでの反復数の上限.ここで -1 は,k-means クラスタリングが収束するまで続けられることを意味します - /// k-means クラスタリングの初期中心を選択するアルゴリズム. - /// このパラメータ(クラスタ境界インデックス)は,階層的 k-means tree の探索方法に影響を与えます. cb_index が0の場合,最も近い中心のクラスタが,次に探索される k-means 領域になります.0より大きい値の場合も,領域サイズが考慮されます -#else /// - /// + /// Constructor /// /// The branching factor to use for the hierarchical k-means tree /// The maximum number of iterations to use in the k-means clustering stage when building the k-means tree. A value of -1 used here means that the k-means clustering should be iterated until convergence /// The algorithm to use for selecting the initial centers when performing a k-means clustering step. /// This parameter (cluster boundary index) influences the way exploration is performed in the hierarchical kmeans tree. When cb_index is zero the next kmeans domain to be explored is choosen to be the one with the closest center. A value greater then zero also takes into account the size of the domain. -#endif public KMeansIndexParams(int branching = 32, int iterations = 11, FlannCentersInit centersInit = FlannCentersInit.Random, float cbIndex = 0.2f) : base(null) { diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/LinearIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/LinearIndexParams.cs index 0d93f5ce3..1cf986396 100644 --- a/src/OpenCvSharp/Modules/flann/IndexParams/LinearIndexParams.cs +++ b/src/OpenCvSharp/Modules/flann/IndexParams/LinearIndexParams.cs @@ -3,19 +3,13 @@ namespace OpenCvSharp.Flann { -#if LANG_JP - /// - /// 線形のブルートフォース探索が行われます - /// -#else /// /// the index will perform a linear, brute-force search. /// -#endif public class LinearIndexParams : IndexParams { /// - /// + /// Constructor /// public LinearIndexParams() : base(null) diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/LshIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/LshIndexParams.cs index 41a75b8d0..2ac11c5ce 100644 --- a/src/OpenCvSharp/Modules/flann/IndexParams/LshIndexParams.cs +++ b/src/OpenCvSharp/Modules/flann/IndexParams/LshIndexParams.cs @@ -3,32 +3,17 @@ namespace OpenCvSharp.Flann { -#if LANG_JP - /// - /// Multi-Probe LSH を使用したインデックスが表現されます. - /// -#else /// /// When using a parameters object of this type the index created uses multi-probe LSH (by Multi-Probe LSH: Efficient Indexing for High-Dimensional Similarity Search by Qin Lv, William Josephson, Zhe Wang, Moses Charikar, Kai Li., Proceedings of the 33rd International Conference on Very Large Data Bases (VLDB). Vienna, Austria. September 2007) /// -#endif public class LshIndexParams : IndexParams { -#if LANG_JP - /// - /// - /// - /// 使用するハッシュテーブルの数 (通常、10 から 30) - /// ビットで表現されるハッシュキーのサイズ (通常、10 から 20) - /// 近接するバケツのチェックのためにシフトするビットの数 (0 は LSH の標準、推奨は 2) -#else /// - /// + /// Constructor /// /// The number of hash tables to use (between 10 and 30 usually). /// The size of the hash key in bits (between 10 and 20 usually). /// The number of bits to shift to check for neighboring buckets (0 is regular LSH, 2 is recommended). -#endif public LshIndexParams(int tableNumber, int keySize, int multiProbeLevel) : base(null) { diff --git a/src/OpenCvSharp/Modules/flann/IndexParams/SavedIndexParams.cs b/src/OpenCvSharp/Modules/flann/IndexParams/SavedIndexParams.cs index 28452e3a6..170bede14 100644 --- a/src/OpenCvSharp/Modules/flann/IndexParams/SavedIndexParams.cs +++ b/src/OpenCvSharp/Modules/flann/IndexParams/SavedIndexParams.cs @@ -3,19 +3,13 @@ namespace OpenCvSharp.Flann { -#if LANG_JP - /// - /// ディスクにあらかじめ保存されたデータを読み出すために利用されます. - /// -#else /// /// This object type is used for loading a previously saved index from the disk. /// -#endif public class SavedIndexParams : IndexParams { /// - /// + /// Constructor /// /// public SavedIndexParams(string fileName) diff --git a/src/OpenCvSharp/Modules/highgui/CvTrackbar.cs b/src/OpenCvSharp/Modules/highgui/CvTrackbar.cs index 225484b57..56db1adf3 100644 --- a/src/OpenCvSharp/Modules/highgui/CvTrackbar.cs +++ b/src/OpenCvSharp/Modules/highgui/CvTrackbar.cs @@ -4,60 +4,36 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// Windowに貼り付けて操作するトラックバー - /// -#else /// /// Trackbar that is shown on OpenCV Window /// -#endif public class CvTrackbar : DisposableObject { private readonly int result; - private TrackbarCallback callback; private TrackbarCallbackNative callbackNative; private GCHandle gchCallback; private GCHandle gchCallbackNative; #region Properties -#if LANG_JP - /// - /// トラックバーの名前を取得する - /// -#else + /// /// Name of this trackbar /// -#endif public string TrackbarName { get; } -#if LANG_JP - /// - /// 親ウィンドウの名前を取得する - /// -#else /// /// Name of parent window /// -#endif public string WindowName { get; } /// /// /// - public TrackbarCallback Callback => callback; + public TrackbarCallback Callback { get; } -#if LANG_JP - /// - /// トラックバーの現在の値を取得・設定する - /// -#else /// /// Gets or sets a numeric value that represents the current position of the scroll box on the track bar. /// -#endif public int Pos { get @@ -66,11 +42,8 @@ public int Pos NativeMethods.highgui_getTrackbarPos(TrackbarName, WindowName, out var ret)); return ret; } - set - { - NativeMethods.HandleException( + set => NativeMethods.HandleException( NativeMethods.highgui_setTrackbarPos(TrackbarName, WindowName, value)); - } } /// @@ -79,40 +52,20 @@ public int Pos public int Result => result; #endregion - - + #region Init and Disposal -#if LANG_JP - /// - /// 初期化(目盛りは0~100) - /// - /// トラックバーの名前 - /// トラックバーの親ウィンドウ名 - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else /// /// Constructor (value=0, max=100) /// /// Trackbar name /// Window name /// Callback handler -#endif internal CvTrackbar(string name, string window, TrackbarCallback callback) : this(name, window, 0, 100, callback) { } -#if LANG_JP - /// - /// 初期化 - /// - /// トラックバーの名前 - /// トラックバーの親ウィンドウ名 - /// スライダの初期位置 - /// スライダの最大値.最小値は常に 0. - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else /// /// Constructor /// @@ -121,7 +74,6 @@ internal CvTrackbar(string name, string window, TrackbarCallback callback) /// Initial slider position /// The upper limit of the range this trackbar is working with. /// Callback handler -#endif internal CvTrackbar(string trackbarName, string windowName, int initialPos, int max, TrackbarCallback callback) { if (string.IsNullOrEmpty(trackbarName)) @@ -129,7 +81,7 @@ internal CvTrackbar(string trackbarName, string windowName, int initialPos, int if (string.IsNullOrEmpty(windowName)) throw new ArgumentNullException(nameof(windowName)); - this.callback = callback ?? throw new ArgumentNullException(nameof(callback)); + Callback = callback ?? throw new ArgumentNullException(nameof(callback)); TrackbarName = trackbarName; WindowName = windowName; diff --git a/src/OpenCvSharp/Modules/highgui/Enum/ButtonType.cs b/src/OpenCvSharp/Modules/highgui/Enum/ButtonType.cs new file mode 100644 index 000000000..5def31d7b --- /dev/null +++ b/src/OpenCvSharp/Modules/highgui/Enum/ButtonType.cs @@ -0,0 +1,25 @@ +namespace OpenCvSharp +{ + // TODO support createButton + + /// + /// Button type flags (cv::createButton) + /// + public enum ButtonType + { + /// + /// The button will be a push button. + /// + PushButton = 0, + + /// + /// The button will be a checkbox button. + /// + Checkbox = 1, + + /// + /// The button will be a radiobox button. The radiobox on the same buttonbar (same line) are exclusive; one on can be select at the time. + /// + Radiobox = 2, + } +} diff --git a/src/OpenCvSharp/Modules/highgui/Enum/ButtonTypes.cs b/src/OpenCvSharp/Modules/highgui/Enum/ButtonTypes.cs deleted file mode 100644 index f26f909c2..000000000 --- a/src/OpenCvSharp/Modules/highgui/Enum/ButtonTypes.cs +++ /dev/null @@ -1,51 +0,0 @@ -namespace OpenCvSharp -{ - // TODO support createButton - -#if LANG_JP - /// - /// cv::createButton で用いるボタンの種類 - /// -#else - /// - /// Button type flags (cv::createButton) - /// -#endif - public enum ButtonTypes - { -#if LANG_JP - /// - /// 通常のプッシュボタン. - /// -#else - /// - /// The button will be a push button. - /// -#endif - PushButton = 0, - -#if LANG_JP - /// - /// チェックボックスボタン - /// -#else - /// - /// The button will be a checkbox button. - /// -#endif - Checkbox = 1, - -#if LANG_JP - /// - /// ラジオボックスボタン. - /// 同じボタンバー(同じライン上)にあるラジオボックスは,排他的です. - /// つまり,同時に1つしか選択できません. - /// -#else - /// - /// The button will be a radiobox button. The radiobox on the same buttonbar (same line) are exclusive; one on can be select at the time. - /// -#endif - Radiobox = 2, - } -} diff --git a/src/OpenCvSharp/Modules/highgui/MouseCallback.cs b/src/OpenCvSharp/Modules/highgui/MouseCallback.cs index 88ddfac49..25305dd0e 100644 --- a/src/OpenCvSharp/Modules/highgui/MouseCallback.cs +++ b/src/OpenCvSharp/Modules/highgui/MouseCallback.cs @@ -3,16 +3,6 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cvSetMouseCallbackで指定する、HighGUIウィンドウでマウスイベントが発生したときのイベント処理を行うデリゲート - /// - /// MouseEventTypes であらわされるフラグのうちのひとつ - /// 画像内でのマウスポインタのx座標 - /// 画像内でのマウスポインタのy座標 - /// MouseEventFlags であらわされるフラグの論理和 - /// -#else /// /// Delegate to be called every time mouse event occurs in the specified window. /// @@ -21,7 +11,6 @@ namespace OpenCvSharp /// y-coordinates of mouse pointer in image coordinates /// a combination of MouseEventFlags /// -#endif [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void MouseCallback( MouseEventTypes @event, diff --git a/src/OpenCvSharp/Modules/highgui/TrackbarCallback.cs b/src/OpenCvSharp/Modules/highgui/TrackbarCallback.cs index e9d5f5c38..cd6183ffe 100644 --- a/src/OpenCvSharp/Modules/highgui/TrackbarCallback.cs +++ b/src/OpenCvSharp/Modules/highgui/TrackbarCallback.cs @@ -3,16 +3,10 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// CvTrackbarが操作されたときのイベント処理を行うデリゲート - /// -#else /// /// Delegate to be called every time the slider changes the position. /// /// -#endif [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate void TrackbarCallback(int pos); diff --git a/src/OpenCvSharp/Modules/highgui/Window.cs b/src/OpenCvSharp/Modules/highgui/Window.cs index 4fbf18c9d..5177a9946 100644 --- a/src/OpenCvSharp/Modules/highgui/Window.cs +++ b/src/OpenCvSharp/Modules/highgui/Window.cs @@ -9,15 +9,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// HighGUIウィンドウのラッパー - /// -#else /// /// Wrapper of HighGUI window /// -#endif public class Window : DisposableObject { #region Field @@ -36,28 +30,14 @@ public class Window : DisposableObject #region Init and Disposal -#if LANG_JP - /// - /// 適当なウィンドウ名で初期化 - /// -#else /// /// Creates a window with a random name /// -#endif public Window() : this(DefaultName(), null, WindowFlags.AutoSize) { } -#if LANG_JP - /// - /// ウィンドウ名と画像の表示モードと始めから表示しておく画像を指定して初期化 - /// - /// ウィンドウの識別に用いられるウィンドウ名で,ウィンドウのタイトルバ ーに表示される. - /// ウィンドウのフラグ - /// ウィンドウに表示する画像 -#else /// /// Creates a window /// @@ -65,7 +45,6 @@ public Window() /// Image to be shown. /// Flags of the window. Currently the only supported flag is WindowMode.AutoSize. /// If it is set, window size is automatically adjusted to fit the displayed image (see cvShowImage), while user can not change the window size manually. -#endif public Window(string name, Mat? image = null, WindowFlags flags = WindowFlags.AutoSize) { if (string.IsNullOrEmpty(name)) @@ -119,29 +98,17 @@ protected override void DisposeManaged() base.DisposeManaged(); } -#if LANG_JP - /// - /// ウィンドウを閉じる - /// -#else /// /// Destroys this window. /// -#endif public void Close() { Dispose(); } -#if LANG_JP - /// - /// 全ての HighGUI ウィンドウを破棄する - /// -#else /// /// Destroys all the opened HighGUI windows. /// -#endif public static void DestroyAllWindows() { foreach (var window in Windows.Values) @@ -168,34 +135,22 @@ public static void DestroyAllWindows() #region Properties -#if LANG_JP - /// - /// 表示する画像を取得・設定する - /// -#else /// /// Gets or sets an image to be shown /// -#endif public Mat? Image { - get { return image; } - set { ShowImage(value); } + get => image; + set => ShowImage(value); } -#if LANG_JP - /// - /// ウィンドウの名前を取得する - /// -#else /// /// Gets window name /// -#endif public string Name { - get { return name; } - private set { name = value; } + get => name; + private set => name = value; } /// @@ -219,22 +174,12 @@ internal MouseCallback? MouseCallback #region Methods - #region CreateTrackbar - -#if LANG_JP - /// - /// ウィンドウにトラックバーを作成し、作成したトラックバーを返す - /// - /// トラックバーの名前 - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else /// /// Creates the trackbar and attaches it to this window /// /// Name of created trackbar. /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); /// -#endif public CvTrackbar CreateTrackbar(string trackbarName, TrackbarCallback callback) { var trackbar = new CvTrackbar(trackbarName, name, callback); @@ -242,15 +187,6 @@ public CvTrackbar CreateTrackbar(string trackbarName, TrackbarCallback callback) return trackbar; } -#if LANG_JP - /// - /// ウィンドウにトラックバーを作成し、作成したトラックバーを返す - /// - /// トラックバーの名前 - /// スライダの初期位置 - /// スライダの最大値.最小値は常に 0. - /// スライダの位置が変更されるたびに呼び出されるデリゲート -#else /// /// Creates the trackbar and attaches it to this window /// @@ -259,206 +195,83 @@ public CvTrackbar CreateTrackbar(string trackbarName, TrackbarCallback callback) /// Maximal position of the slider. Minimal position is always 0. /// the function to be called every time the slider changes the position. This function should be prototyped as void Foo(int); /// -#endif + public CvTrackbar CreateTrackbar(string trackbarName, int initialPos, int max, TrackbarCallback callback) { var trackbar = new CvTrackbar(trackbarName, name, initialPos, max, callback); trackbars.Add(trackbarName, trackbar); return trackbar; } - - #endregion - - #region DisplayOverlay -#if LANG_JP - /// - /// ウィンドウ画像上に,delay ミリ秒間だけテキストをオーバレイ表示します.これは,画像データを変更しません.テキストは画像の一番上に表示されます. - /// - /// ウィンドウ画像上に描画される,オーバレイテキスト. - /// オーバレイテキストを表示する時間.直前のオーバレイテキストがタイムアウトするより前に,この関数が呼ばれると,タイマーは再起動されてテキストが更新されます.この値が0の場合,テキストは表示されません. -#else /// /// Display text on the window's image as an overlay for delay milliseconds. This is not editing the image's data. The text is display on the top of the image. /// /// Overlay text to write on the window’s image /// Delay to display the overlay text. If this function is called before the previous overlay text time out, the timer is restarted and the text updated. /// If this value is zero, the text never disappears. -#endif public void DisplayOverlay(string text, int delayMs) { throw new NotImplementedException(); //Cv.DisplayOverlay(name, text, delayms); } - #endregion - - #region DisplayStatusBar - -#if LANG_JP - /// - /// ウィンドウのステータスバーに,delay ミリ秒間だけテキストを表示します. - /// - /// ウィンドウのステータスバー上に描画されるテキスト. - /// テキストが表示される時間.直前のテキストがタイムアウトするより前に,この関数が呼ばれると,タイマーは再起動されてテキストが更新されます.この値が0の場合,テキストは表示されません. -#else /// /// /// /// Text to write on the window’s statusbar /// Delay to display the text. If this function is called before the previous text time out, the timer is restarted and the text updated. If this value is zero, the text never disapers. -#endif public void DisplayStatusBar(string text, int delayms) { throw new NotImplementedException(); //Cv.DisplayStatusBar(name, text, delayms); } - #endregion - - #region GetProperty - -#if LANG_JP - /// - /// ウィンドウのプロパティを取得する - /// - /// プロパティの種類 - /// プロパティの値 -#else /// /// Get Property of the window /// /// Property identifier /// Value of the specified property -#endif public double GetProperty(WindowPropertyFlags propId) { return Cv2.GetWindowProperty(name, propId); } - - #endregion - - #region LoadWindowParameters - -#if LANG_JP - /// - /// ウィンドウのパラメータを読み込みます. - /// -#else - /// - /// Load parameters of the window. - /// -#endif - public void LoadWindowParameters() - { - throw new NotImplementedException(); - //Cv.LoadWindowParameters(name); - } - - #endregion - - #region Move - -#if LANG_JP - /// - /// ウィンドウの位置を変更する - /// - /// 左上のコーナーの新しい x 座標 - /// 左上のコーナーの新しい y 座標 -#else + /// /// Sets window position /// /// New x coordinate of top-left corner /// New y coordinate of top-left corner -#endif public void Move(int x, int y) { NativeMethods.HandleException( NativeMethods.highgui_moveWindow(name, x, y)); } - #endregion - - #region Resize - -#if LANG_JP - /// - /// ウィンドウサイズを変更する - /// - /// 新しい幅 - /// 新しい高さ -#else /// /// Sets window size /// /// New width /// New height -#endif public void Resize(int width, int height) { NativeMethods.HandleException( NativeMethods.highgui_resizeWindow(name, width, height)); } - #endregion - - #region SaveWindowParameters - -#if LANG_JP - /// - /// ウィンドウのパラメータを保存します. - /// -#else - /// - /// Save parameters of the window. - /// -#endif - public void SaveWindowParameters() - { - throw new NotImplementedException(); - //Cv.SaveWindowParameters(name); - } - - #endregion - - #region SetProperty - -#if LANG_JP - /// - /// ウィンドウのプロパティを設定する - /// - /// プロパティの種類 - /// プロパティに設定する値 -#else /// /// Set Property of the window /// /// Property identifier /// New value of the specified property -#endif public void SetProperty(WindowPropertyFlags propId, double propValue) { Cv2.SetWindowProperty(name, propId, propValue); } - #endregion - - #region ShowImage - -#if LANG_JP - /// - /// 指定したウィンドウ内に画像を表示する(cvShowImage相当). - /// このウィンドウのフラグに AutoSize が指定されていた場合は,画像はオリジナルサイズで表示される. - /// それ以外の場合,ウィンドウサイズに合わせて 表示画像サイズが変更される. - /// - /// 画像ヘッダ -#else /// /// Shows the image in this window /// /// Image to be shown. -#endif public void ShowImage(Mat? img) { if (img != null) @@ -485,8 +298,6 @@ public void ShowImage(UMat? img) } } - #endregion - /// /// get native window handle (HWND in case of Win32 and Widget in case of X Window) /// @@ -497,19 +308,11 @@ public IntPtr GetHandle() return ret; } -#if LANG_JP - /// - /// 何かキーが押されるか、若しくはdelayで指定した時間(ミリ秒)待機する。 - /// - /// 遅延時間(ミリ秒) - /// キーが押された場合はそのキーコードを,キーが押されないまま指定されたタイムアウト時間が過ぎてしまった場合は -1 -#else /// /// Waits for a pressed key /// /// Delay in milliseconds. /// Key code -#endif public static int WaitKey(int delay = 0) { return Cv2.WaitKey(delay); @@ -527,17 +330,10 @@ public static int WaitKeyEx(int delay = 0) return Cv2.WaitKeyEx(delay); } -#if LANG_JP - /// - /// 引数に指定した画像をそれぞれ別のウィンドウで表示し、キー入力待ち状態にする。 - /// - /// 表示させる画像。任意の個数を指定できる。 -#else /// /// /// /// -#endif public static void ShowImages(params Mat[] images) { if (images == null) @@ -593,18 +389,11 @@ public static void ShowImages(IEnumerable images, IEnumerable names } } -#if LANG_JP - /// - /// 指定した名前に対応するウィンドウを得る - /// - /// -#else /// /// Retrieves a created window by name /// /// /// -#endif public static Window? GetWindowByName(string name) { if (string.IsNullOrEmpty(name)) @@ -616,19 +405,11 @@ public static void ShowImages(IEnumerable images, IEnumerable names return null; } -#if LANG_JP - /// - /// 指定されたウィンドウ内で発生するマウスイベントに対するコールバック関数を設定する - /// - /// 指定されたウィンドウ内でマウスイベントが発生するたびに呼ばれるデリゲート - /// -#else /// /// Sets the callback function for mouse events occuting within the specified window. /// /// Reference to the function to be called every time mouse event occurs in the specified window. /// -#endif public void SetMouseCallback(MouseCallback onMouse, IntPtr userData = default) { Cv2.SetMouseCallback(name, onMouse, userData); diff --git a/src/OpenCvSharp/Modules/imgcodecs/Enum/ImreadModes.cs b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImreadModes.cs index 86e3b22ee..29b468972 100644 --- a/src/OpenCvSharp/Modules/imgcodecs/Enum/ImreadModes.cs +++ b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImreadModes.cs @@ -3,76 +3,35 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cvLoadImageで用いる読み込みフラグ . - /// -#else /// /// Specifies colorness and Depth of the loaded image /// -#endif [Flags] public enum ImreadModes { - #if LANG_JP - /// - /// 8 ビット,カラーまたはグレースケール [CV_LOAD_IMAGE_UNCHANGED] - /// -#else /// /// If set, return the loaded image as is (with alpha channel, otherwise it gets cropped). /// -#endif Unchanged = -1, - -#if LANG_JP - /// - /// 8 ビット,グレースケール [CV_LOAD_IMAGE_GRAYSCALE] - /// -#else /// /// If set, always convert image to the single channel grayscale image. /// -#endif Grayscale = 0, - -#if LANG_JP - /// - /// AnyDepth と併用されない限り 8 ビット,カラー [CV_LOAD_IMAGE_COLOR] - /// -#else /// /// If set, always convert image to the 3 channel BGR color image. /// -#endif Color = 1, - -#if LANG_JP - /// - ///任意のデプス,グレー [CV_LOAD_IMAGE_ANYDEPTH] - /// -#else /// /// If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit. /// -#endif AnyDepth = 2, - -#if LANG_JP - /// - /// 8 ビット,カラーまたはグレースケール [CV_LOAD_IMAGE_ANYCOLOR]. - /// AnyDepth と併用可能. - /// -#else /// /// If set, the image is read in any possible color format. /// -#endif AnyColor = 4, /// diff --git a/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteFlags.cs b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteFlags.cs index 666cb63b9..16ccbecb3 100644 --- a/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteFlags.cs +++ b/src/OpenCvSharp/Modules/imgcodecs/Enum/ImwriteFlags.cs @@ -1,26 +1,14 @@  namespace OpenCvSharp { -#if LANG_JP - /// - /// cv::imwrite, cv::inencode で用いるエンコードの種類 - /// -#else /// /// The format type IDs for cv::imwrite and cv::inencode /// -#endif public enum ImwriteFlags { -#if LANG_JP - /// - /// JPEGの場合のフラグ。0から100の値を取る(大きいほど高品質)。デフォルト値は95。 - /// -#else /// /// For JPEG, it can be a quality from 0 to 100 (the higher is the better). Default value is 95. /// -#endif JpegQuality = 1, /// @@ -48,16 +36,10 @@ public enum ImwriteFlags /// JpegChromaQuality = 6, -#if LANG_JP - /// - /// PNGの場合のフラグ。圧縮レベルを0から9の値で指定する(大きいほど高圧縮率で、かつ圧縮に時間を要する)。デフォルト値は3。 - /// -#else /// /// For PNG, it can be the compression level from 0 to 9. /// A higher value means a smaller size and longer compression time. Default value is 3. /// -#endif PngCompression = 16, /// @@ -70,15 +52,9 @@ public enum ImwriteFlags /// PngBilevel = 18, -#if LANG_JP - /// - /// PPM, PGM, PBMの場合のフラグ。フォーマットをバイナリ(1)かアスキー(0)かで指定する。デフォルト値は1。 - /// -#else /// /// For PPM, PGM, or PBM, it can be a binary format flag, 0 or 1. Default value is 1. /// -#endif PxmBinary = 32, /// diff --git a/src/OpenCvSharp/Modules/imgcodecs/ImageEncodingParam.cs b/src/OpenCvSharp/Modules/imgcodecs/ImageEncodingParam.cs index a29ce89c9..ffaea9411 100644 --- a/src/OpenCvSharp/Modules/imgcodecs/ImageEncodingParam.cs +++ b/src/OpenCvSharp/Modules/imgcodecs/ImageEncodingParam.cs @@ -2,54 +2,28 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// cv::imwrite, cv::imencode で用いるエンコードパラメータ - /// -#else /// /// The format-specific save parameters for cv::imwrite and cv::imencode /// -#endif + // TODO record [Serializable] - public class ImageEncodingParam + public record ImageEncodingParam { -#if LANG_JP - /// - /// エンコードの種類 - /// -#else /// /// format type ID /// -#endif - public ImwriteFlags EncodingId { get; set; } + public ImwriteFlags EncodingId { get; } -#if LANG_JP - /// - /// パラメータの値 - /// -#else /// /// value of parameter /// -#endif - public int Value { get; set; } - + public int Value { get; } -#if LANG_JP - /// - /// 初期化 - /// - /// エンコードの種類 - /// パラメータの値 -#else /// /// Constructor /// /// format type ID /// value of parameter -#endif public ImageEncodingParam(ImwriteFlags id, int value) { EncodingId = id; diff --git a/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs b/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs index e9b771526..0f78e831a 100644 --- a/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs +++ b/src/OpenCvSharp/Modules/imgproc/ConnectedComponent.cs @@ -186,7 +186,7 @@ private Mat GetLabelMask(int label) using (var cmp = new Mat(rows, cols, MatType.CV_32SC1, Scalar.All(label))) { var result = new Mat(); - Cv2.Compare(labels, cmp, result, CmpTypes.EQ); + Cv2.Compare(labels, cmp, result, CmpType.EQ); return result; } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/AdaptiveThresholdTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/AdaptiveThresholdTypes.cs index 38325e4be..35a3281aa 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/AdaptiveThresholdTypes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/AdaptiveThresholdTypes.cs @@ -1,38 +1,24 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// 適応的閾値処理で使用するアルゴリズムの種類 - /// -#else /// /// Adaptive thresholding algorithms /// -#endif + /// + ///https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L333 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum AdaptiveThresholdTypes { -#if LANG_JP - /// - /// 注目ピクセルの block_size × block_size 隣接領域の平均から,param1 を引いた値を閾値とする. - /// -#else /// /// It is a mean of block_size × block_size pixel neighborhood, subtracted by param1. /// -#endif MeanC = 0, - -#if LANG_JP - /// - /// 注目ピクセルの block_size × block_size 隣接領域の重み付き総和(ガウシアン)から param1 を引いた値を閾値とする. - /// -#else /// /// it is a weighted sum (Gaussian) of block_size × block_size pixel neighborhood, subtracted by param1. /// -#endif GaussianC = 1, } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ColorConversionCodes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ColorConversionCodes.cs index 054c0b683..33eccd949 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/ColorConversionCodes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ColorConversionCodes.cs @@ -1,4 +1,6 @@ -#pragma warning disable 1591 +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable 1591 // ReSharper disable InconsistentNaming // ReSharper disable IdentifierTypo @@ -6,15 +8,13 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// 色空間の変換の方法 - /// -#else /// /// Color conversion operation for cv::cvtColor /// -#endif + /// + ///https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L528 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum ColorConversionCodes { BGR2BGRA = 0, //!< add alpha channel to RGB or BGR image diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ContourApproximationModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ContourApproximationModes.cs index a446184f3..257f3b421 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/ContourApproximationModes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ContourApproximationModes.cs @@ -1,64 +1,36 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// 輪郭の近似手法 - /// -#else /// /// Approximation method (for all the modes, except CV_RETR_RUNS, which uses built-in approximation). /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L431 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum ContourApproximationModes { -#if LANG_JP - /// - /// [CHAIN_APPROX_NONE] - /// -#else /// /// CHAIN_APPROX_NONE - translate all the points from the chain code into points; /// -#endif ApproxNone = 1, - -#if LANG_JP - /// - /// 水平・垂直・斜めの線分を圧縮し,それらの端点のみを残します.例えば,まっすぐな矩形の輪郭線は,4つの点にエンコードされます. [CV_CHAIN_APPROX_SIMPLE] - /// -#else /// /// CHAIN_APPROX_SIMPLE - compress horizontal, vertical, and diagonal segments, that is, the function leaves only their ending points; /// -#endif ApproxSimple = 2, - -#if LANG_JP - /// - /// Teh-Chinチェーン近似アルゴリズムの1つを適用します. TehChin89 を参照してください. [CV_CHAIN_APPROX_TC89_L1] - /// -#else /// /// CHAIN_APPROX_TC89_L1 - apply one of the flavors of Teh-Chin chain approximation algorithm. /// -#endif -// ReSharper disable once InconsistentNaming + // ReSharper disable once InconsistentNaming ApproxTC89L1 = 3, - -#if LANG_JP - /// - /// Teh-Chinチェーン近似アルゴリズムの1つを適用します. TehChin89 を参照してください. [CV_CHAIN_APPROX_TC89_KCOS] - /// -#else /// /// CHAIN_APPROX_TC89_KCOS - apply one of the flavors of Teh-Chin chain approximation algorithm. /// -#endif -// ReSharper disable once InconsistentNaming + // ReSharper disable once InconsistentNaming ApproxTC89KCOS = 4, } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/DistanceMaskSize.cs b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTransformMasks.cs similarity index 64% rename from src/OpenCvSharp/Modules/imgproc/Enum/DistanceMaskSize.cs rename to src/OpenCvSharp/Modules/imgproc/Enum/DistanceTransformMasks.cs index 045c24ee2..d0ba2cb9d 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/DistanceMaskSize.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTransformMasks.cs @@ -2,17 +2,14 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// 距離変換 (distance transform) のマスクサイズ - /// -#else /// /// Mask size for distance transform /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L312 + /// [Flags] - public enum DistanceMaskSize + public enum DistanceTransformMasks { /// /// 3 diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTypes.cs index eb1e5bcfa..91c34b90a 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTypes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/DistanceTypes.cs @@ -1,15 +1,14 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// cvDistTransformで指定する距離の種類 - /// -#else /// /// Type of distance for cvDistTransform /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L300 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum DistanceTypes { /// diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/FlipMode.cs b/src/OpenCvSharp/Modules/imgproc/Enum/FlipMode.cs index 561b58f6b..d0005331e 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/FlipMode.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/FlipMode.cs @@ -1,50 +1,23 @@ - -namespace OpenCvSharp +namespace OpenCvSharp { -#if LANG_JP - /// - /// 配列の反転方法 - /// -#else /// /// Specifies how to flip the array /// -#endif public enum FlipMode { -#if LANG_JP - /// - /// x軸周りでの反転 - /// -#else /// /// means flipping around x-axis /// -#endif X = 0, - -#if LANG_JP - /// - /// y軸周りでの反転 - /// -#else /// /// means flipping around y-axis /// -#endif Y = 1, - -#if LANG_JP - /// - /// 両軸周りでの反転 - /// -#else /// /// means flipping around both axises /// -#endif // ReSharper disable once InconsistentNaming XY = -1 } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/FloodFillFlags.cs b/src/OpenCvSharp/Modules/imgproc/Enum/FloodFillFlags.cs index 8d839b38e..8684f38f8 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/FloodFillFlags.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/FloodFillFlags.cs @@ -2,69 +2,34 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// floodFillの処理フラグ - /// -#else /// /// floodFill Operation flags. Lower bits contain a connectivity value, 4 (default) or 8, used within the function. Connectivity determines which neighbors of a pixel are considered. Upper bits can be 0 or a combination of the following flags: /// -#endif [Flags] public enum FloodFillFlags { -#if LANG_JP - /// - /// 4連結による線分 - /// [= 4] - /// -#else /// /// 4-connected line. /// [= 4] /// -#endif Link4 = 4, -#if LANG_JP - /// - /// 8連結による線分 - /// [= 8] - /// -#else /// /// 8-connected line. /// [= 8] /// -#endif Link8 = 8, -#if LANG_JP /// /// If set, the difference between the current pixel and seed pixel is considered. Otherwise, the difference between neighbor pixels is considered (that is, the range is floating). /// [CV_FLOODFILL_FIXED_RANGE] /// -#else - /// - /// If set, the difference between the current pixel and seed pixel is considered. Otherwise, the difference between neighbor pixels is considered (that is, the range is floating). - /// [CV_FLOODFILL_FIXED_RANGE] - /// -#endif FixedRange = 1 << 16, - -#if LANG_JP - /// - /// If set, the function does not change the image ( newVal is ignored), but fills the mask. The flag can be used for the second variant only. - /// [CV_FLOODFILL_MASK_ONLY] - /// -#else /// /// If set, the function does not change the image ( newVal is ignored), but fills the mask. The flag can be used for the second variant only. /// [CV_FLOODFILL_MASK_ONLY] /// -#endif MaskOnly = 1 << 17, } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutModes.cs index 07dc05917..2989cb221 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutModes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/GrabCutModes.cs @@ -2,58 +2,28 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// GrabCutの処理フラグ - /// -#else /// /// GrabCut algorithm flags /// -#endif [Flags] public enum GrabCutModes { -#if LANG_JP - /// - /// 与えられた矩形を用いて,状態とマスクを初期化します. - /// その後,アルゴリズムが iterCount 回繰り返されます. - /// -#else /// /// The function initializes the state and the mask using the provided rectangle. /// After that it runs iterCount iterations of the algorithm. /// -#endif InitWithRect = 0, - -#if LANG_JP - /// - /// 与えられたマスクを用いて状態を初期化します. - /// GC_INIT_WITH_RECT と GC_INIT_WITH_MASK は,一緒に使うことができる - /// ことに注意してください.そして,ROIの外側の全ピクセルは自動的に - /// GC_BGD として初期化されます. - /// -#else /// /// The function initializes the state using the provided mask. /// Note that GC_INIT_WITH_RECT and GC_INIT_WITH_MASK can be combined. /// Then, all the pixels outside of the ROI are automatically initialized with GC_BGD . /// -#endif InitWithMask = 1, - -#if LANG_JP - /// - /// アルゴリズムがすぐに再開することを意味する値. - /// -#else /// /// The value means that the algorithm should just resume. /// -#endif Eval = 2, } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/HistCompMethods.cs b/src/OpenCvSharp/Modules/imgproc/Enum/HistCompMethods.cs index 60b85fb88..79ed27678 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/HistCompMethods.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/HistCompMethods.cs @@ -1,61 +1,34 @@ -namespace OpenCvSharp +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp { -#if LANG_JP - /// - /// cvCompareHistで用いる、CvHistogramの比較方法 - /// -#else /// /// Comparison methods for cvCompareHist /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L497 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum HistCompMethods { -#if LANG_JP - /// - /// 相関 [CV_COMP_CORREL] - /// -#else /// /// Correlation [CV_COMP_CORREL] /// -#endif Correl = 0, - -#if LANG_JP - /// - /// カイ二乗 [CV_COMP_CHISQR] - /// -#else /// /// Chi-Square [CV_COMP_CHISQR] /// -#endif Chisqr = 1, - -#if LANG_JP - /// - /// 交差 [CV_COMP_INTERSECT] - /// -#else /// /// Intersection [CV_COMP_INTERSECT] /// -#endif Intersect = 2, - -#if LANG_JP - /// - /// Bhattacharyya距離 [CV_COMP_BHATTACHARYYA]. 正規化されたヒストグラムでのみ実行可能である. - /// -#else /// /// Bhattacharyya distance [CV_COMP_BHATTACHARYYA] /// -#endif Bhattacharyya = 3, /// @@ -74,7 +47,7 @@ public enum HistCompMethods /// Kullback-Leibler divergence /// \f[d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)\f] /// -// ReSharper disable once InconsistentNaming + // ReSharper disable once InconsistentNaming KLDiv = 5 } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/HoughMethods.cs b/src/OpenCvSharp/Modules/imgproc/Enum/HoughModes.cs similarity index 80% rename from src/OpenCvSharp/Modules/imgproc/Enum/HoughMethods.cs rename to src/OpenCvSharp/Modules/imgproc/Enum/HoughModes.cs index 26f8940ed..a8dbaef47 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/HoughMethods.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/HoughModes.cs @@ -1,18 +1,16 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// ハフ変換の種類 - /// -#else /// /// Variants of a Hough transform /// -#endif - public enum HoughMethods + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L465 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] + public enum HoughModes { - /* */ /// /// classical or standard Hough transform. /// Every line is represented by two floating-point numbers \f$(\rho, \theta)\f$ , diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/InterpolationFlags.cs b/src/OpenCvSharp/Modules/imgproc/Enum/InterpolationFlags.cs index 67f76422e..041c91632 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/InterpolationFlags.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/InterpolationFlags.cs @@ -2,60 +2,30 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// 画像の補間方法 - /// -#else /// /// Interpolation algorithm /// -#endif [Flags] public enum InterpolationFlags { -#if LANG_JP - /// - /// 最近隣接補間 - /// -#else /// /// Nearest-neighbor interpolation, /// -#endif Nearest = 0, -#if LANG_JP - /// - /// バイリニア補間 - /// -#else /// /// Bilinear interpolation (used by default) /// -#endif Linear = 1, - -#if LANG_JP - /// - /// バイキュービック補間 - /// -#else + /// /// Bicubic interpolation. /// -#endif Cubic = 2, -#if LANG_JP - /// - /// ピクセル領域の関係を用いてリサンプリングする.画像縮小の際は,モアレの無い処理結果を得ることができる手法である.拡大の際は,CV_INTER_NN と同様 . - /// -#else /// /// Resampling using pixel area relation. It is the preferred method for image decimation that gives moire-free results. In case of zooming it is similar to CV_INTER_NN method. /// -#endif Area = 3, /// @@ -73,28 +43,15 @@ public enum InterpolationFlags /// Max = 7, -#if LANG_JP - /// - /// 出力画像の全ピクセルの値を埋める.対応ピクセルが入力画像外であるようなピクセルである場合は, fillvalがセットされる - /// -#else /// /// Fill all the destination image pixels. If some of them correspond to outliers in the source image, they are set to fillval. /// -#endif WarpFillOutliers = 8, -#if LANG_JP - /// - /// このフラグは map_matrixが出力画像から入力画像への逆変換のための行列であることを意味するので,直接ピクセル補間に用いることができる. - /// これがセットされていない場合,この関数は map_matrix を使って逆変換を計算する. - /// -#else /// /// Indicates that matrix is inverse transform from destination image to source and, /// thus, can be used directly for pixel interpolation. Otherwise, the function finds the inverse transform from map_matrix. /// -#endif WarpInverseMap = 16, } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/LineTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/LineTypes.cs index 7ed314a6d..38dae9514 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/LineTypes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/LineTypes.cs @@ -1,15 +1,14 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// 線分の種類 - /// -#else /// /// Type of the line /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L808 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum LineTypes { /// diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/MorphShapes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/MorphShapes.cs index 755fb402b..31d1dcf5b 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/MorphShapes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/MorphShapes.cs @@ -1,50 +1,29 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// 構造要素の形状 - /// -#else /// /// Shape of the structuring element /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L231 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum MorphShapes { -#if LANG_JP - /// - /// 矩形 - /// -#else /// /// A rectangular element /// -#endif Rect = 0, - -#if LANG_JP - /// - /// 十字型 - /// -#else /// /// A cross-shaped element /// -#endif Cross = 1, - -#if LANG_JP - /// - /// 楕円 - /// -#else /// /// An elliptic element /// -#endif Ellipse = 2, } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/MorphTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/MorphTypes.cs index 5fb75abf5..aabb49bb8 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/MorphTypes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/MorphTypes.cs @@ -2,15 +2,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// モルフォロジー演算の種類 - /// -#else /// /// Type of morphological operation /// -#endif [Flags] public enum MorphTypes { @@ -24,68 +18,29 @@ public enum MorphTypes /// Dilate = 1, -#if LANG_JP - /// - /// オープニング [CV_MOP_OPEN]. - /// dst=open(src,element)=dilate(erode(src,element),element) - /// -#else /// /// an opening operation /// -#endif Open = 2, - -#if LANG_JP - /// - /// クロージング [CV_MOP_CLOSE]. - /// dst=close(src,element)=erode(dilate(src,element),element) - /// -#else /// /// a closing operation /// -#endif Close = 3, - -#if LANG_JP - /// - /// モルフォロジー勾配(エッジ検出) [CV_MOP_GRADIENT]. - /// dst=morph_grad(src,element)=dilate(src,element)-erode(src,element) - /// -#else /// /// Morphological gradient /// -#endif Gradient = 4, - -#if LANG_JP - /// - /// トップハット変換(top hat) [CV_MOP_TOPHAT]. - /// dst=tophat(src,element)=src-open(src,element) - /// -#else /// /// "Top hat" /// -#endif TopHat = 5, - -#if LANG_JP - /// - /// ブラックハット変換(black hat) [CV_MOP_BLACKHAT] - /// dst=blackhat(src,element)=close(src,element)-src - /// -#else /// /// "Black hat" /// -#endif BlackHat = 6, /// diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/PixelConnectivity.cs b/src/OpenCvSharp/Modules/imgproc/Enum/PixelConnectivity.cs index cf650e960..a46c8ee4c 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/PixelConnectivity.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/PixelConnectivity.cs @@ -1,38 +1,18 @@ - -namespace OpenCvSharp +namespace OpenCvSharp { -#if LANG_JP - /// - /// CvLineIteratorにおける、走査した線分の接続性 - /// -#else /// /// PixelConnectivity for LineIterator /// -#endif public enum PixelConnectivity { -#if LANG_JP - /// - /// 周囲4方向(上下左右) - /// -#else /// /// Connectivity 4 (N,S,E,W) /// -#endif Connectivity4 = 4, - -#if LANG_JP - /// - /// 周囲8方向 - /// -#else /// /// Connectivity 8 (N,S,E,W,NE,SE,SW,NW) /// -#endif Connectivity8 = 8, } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/RetrievalModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/RetrievalModes.cs index c617b930c..c7cf1888a 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/RetrievalModes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/RetrievalModes.cs @@ -1,80 +1,44 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// 輪郭の抽出モード - /// -#else /// /// mode of the contour retrieval algorithm /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L414 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum RetrievalModes { -#if LANG_JP - /// - /// 最も外側の輪郭のみ抽出 - /// -#else /// /// retrieves only the extreme outer contours. /// It sets `hierarchy[i][2]=hierarchy[i][3]=-1` for all the contours. /// -#endif External = 0, - -#if LANG_JP - /// - /// 全ての輪郭を抽出し,リストに追加 - /// [CV_RETR_LIST] - /// -#else + /// /// retrieves all of the contours without establishing any hierarchical relationships. /// -#endif List = 1, - -#if LANG_JP - /// - /// 全ての輪郭を抽出し,二つのレベルを持つ階層構造を構成する.1番目のレベルは連結成分の外側の境界線,2番目のレベルは穴(連結成分の内側に存在する)の境界線 - /// -#else /// /// retrieves all of the contours and organizes them into a two-level hierarchy. /// At the top level, there are external boundaries of the components. /// At the second level, there are boundaries of the holes. If there is another /// contour inside a hole of a connected component, it is still put at the top level. /// -#endif CComp = 2, - -#if LANG_JP - /// - /// 全ての輪郭を抽出し,枝分かれした輪郭を完全に表現する階層構造を構成する - /// -#else /// /// retrieves all of the contours and reconstructs a full hierarchy /// of nested contours. /// -#endif Tree = 3, - -#if LANG_JP - /// - /// - /// [CV_RETR_FLOODFILL] - /// -#else /// /// /// -#endif FloodFill = 4, } } diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ShapeMatchModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ShapeMatchModes.cs index 985f91aa7..09eb6b07f 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/ShapeMatchModes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ShapeMatchModes.cs @@ -1,15 +1,14 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// cv::matchShapesで用いる比較手法 - /// -#else /// /// Comparison methods for cv::matchShapes /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L453 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum ShapeMatchModes { /// diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/TemplateMatchModes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/TemplateMatchModes.cs index 369f39c56..61fba3ed6 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/TemplateMatchModes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/TemplateMatchModes.cs @@ -1,15 +1,14 @@ - +using System.Diagnostics.CodeAnalysis; + namespace OpenCvSharp { -#if LANG_JP - /// - /// テンプレートマッチングの方法 - /// -#else /// /// Specifies the way the template must be compared with image regions /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/imgproc/include/opencv2/imgproc.hpp#L3672 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum TemplateMatchModes { /// diff --git a/src/OpenCvSharp/Modules/imgproc/Enum/ThresholdTypes.cs b/src/OpenCvSharp/Modules/imgproc/Enum/ThresholdTypes.cs index 1c11f5d7a..3b803883f 100644 --- a/src/OpenCvSharp/Modules/imgproc/Enum/ThresholdTypes.cs +++ b/src/OpenCvSharp/Modules/imgproc/Enum/ThresholdTypes.cs @@ -2,15 +2,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// 閾値処理の種類 - /// -#else /// /// Thresholding type /// -#endif [Flags] public enum ThresholdTypes { diff --git a/src/OpenCvSharp/Modules/imgproc/Model/CircleSegment.cs b/src/OpenCvSharp/Modules/imgproc/Model/CircleSegment.cs index 43ed2edac..5044ce9d1 100644 --- a/src/OpenCvSharp/Modules/imgproc/Model/CircleSegment.cs +++ b/src/OpenCvSharp/Modules/imgproc/Model/CircleSegment.cs @@ -1,174 +1,106 @@ using System; using System.Runtime.InteropServices; -#pragma warning disable CA1051 - namespace OpenCvSharp { -#if LANG_JP - /// - /// cvHoughCirclesで得られる、円のデータ(中心と半径) - /// -#else /// /// circle structure retrieved from cvHoughCircle /// -#endif [Serializable] [StructLayout(LayoutKind.Sequential)] public struct CircleSegment : IEquatable { #region Fields -#if LANG_JP - /// - /// 円の中心 - /// -#else + /// /// Center coordinate of the circle /// -#endif public Point2f Center; -#if LANG_JP - /// - /// 半径 - /// -#else /// /// Radius /// -#endif public float Radius; + #endregion #region Init -#if LANG_JP - /// - /// 初期化 - /// - /// 円の中心 - /// 半径 -#else + /// /// Constructor /// /// center /// radius -#endif public CircleSegment(Point2f center, float radius) { Center = center; Radius = radius; } + #endregion #region Operators -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else + /// /// Specifies whether this object contains the same members as the specified Object. /// /// The Object to test. /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif public bool Equals(CircleSegment obj) { return (Center == obj.Center && Math.Abs(Radius - obj.Radius) < 1e-9); } -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else + /// /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(CircleSegment lhs, CircleSegment rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else + /// /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(CircleSegment lhs, CircleSegment rhs) { return !lhs.Equals(rhs); } + #endregion #region Overrided Methods -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else /// /// Specifies whether this object contains the same members as the specified Object. /// /// The Object to test. /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif public override bool Equals(object? obj) { return base.Equals(obj); } -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else /// /// Returns a hash code for this object. /// /// An integer value that specifies a hash value for this object. -#endif public override int GetHashCode() { return Center.GetHashCode() + Radius.GetHashCode(); } -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else /// /// Converts this object to a human readable string. /// /// A string that represents this object. -#endif public override string ToString() { return $"CvCircleSegment (Center:{Center} Radius:{Radius})"; diff --git a/src/OpenCvSharp/Modules/imgproc/Model/Line2D.cs b/src/OpenCvSharp/Modules/imgproc/Model/Line2D.cs index 80006e026..3d9215607 100644 --- a/src/OpenCvSharp/Modules/imgproc/Model/Line2D.cs +++ b/src/OpenCvSharp/Modules/imgproc/Model/Line2D.cs @@ -2,70 +2,37 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// 始点と変化量であらわされる、2次元の直線を表すオブジェクト - /// -#else /// /// 2-dimentional line vector /// -#endif public class Line2D { #region Properties -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (x成分) - /// -#else + /// /// The X component of the normalized vector collinear to the line /// -#endif - public double Vx { get; set; } -#if LANG_JP - /// - /// 直線に乗るように正規化された方向ベクトル (y成分) - /// -#else + public double Vx { get; } + /// /// The Y component of the normalized vector collinear to the line /// -#endif - public double Vy { get; set; } -#if LANG_JP - /// - /// 直線上の点のx座標 - /// -#else + public double Vy { get; } + /// /// X-coordinate of some point on the line /// -#endif - public double X1 { get; set; } -#if LANG_JP - /// - /// 直線上の点のy座標 - /// -#else + public double X1 { get; } + /// /// Y-coordinate of some point on the line /// -#endif - public double Y1 { get; set; } + public double Y1 { get; } + #endregion #region Init -#if LANG_JP - /// - /// 初期化 - /// - /// 直線に乗るように正規化された方向ベクトル (x成分) - /// 直線に乗るように正規化された方向ベクトル (y成分) - /// 直線上の点のx座標 - /// 直線上の点のy座標 -#else + /// /// Initializes this object /// @@ -73,7 +40,6 @@ public class Line2D /// The Y component of the normalized vector collinear to the line /// Z-coordinate of some point on the line /// Z-coordinate of some point on the line -#endif public Line2D(double vx, double vy, double x1, double y1) { Vx = vx; @@ -81,17 +47,11 @@ public Line2D(double vx, double vy, double x1, double y1) X1 = x1; Y1 = y1; } -#if LANG_JP - /// - /// cvFitLineの出力(float[4])から初期化 - /// - /// cvFitLineの出力結果 -#else + /// /// Initializes by cvFitLine output /// /// The returned value from cvFitLineparam> -#endif public Line2D(float[] line) { if (line == null) @@ -102,6 +62,7 @@ public Line2D(float[] line) X1 = line[2]; Y1 = line[3]; } + #endregion #region Methods @@ -114,6 +75,7 @@ public double GetVectorRadian() { return Math.Atan2(Vy, Vx); } + /// /// /// @@ -123,64 +85,38 @@ public double GetVectorAngle() return GetVectorRadian() * 180 / Math.PI; } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else /// /// Returns the distance between this line and the specified point /// /// -#endif public double Distance(Point point) { return Distance(point.X, point.Y); } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else + /// /// Returns the distance between this line and the specified point /// /// -#endif public double Distance(Point2f point) { return Distance(point.X, point.Y); } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// -#else + /// /// Returns the distance between this line and the specified point /// /// -#endif public double Distance(Point2d point) { return Distance(point.X, point.Y); } -#if LANG_JP - /// - /// 指定した点と直線の距離を返す - /// - /// - /// -#else + /// /// Returns the distance between this line and the specified point /// /// /// -#endif public double Distance(double x, double y) { // 公式で @@ -189,15 +125,6 @@ public double Distance(double x, double y) return Math.Abs(y - m * x - n) / Math.Sqrt(1 + m * m); } -#if LANG_JP - /// - /// 指定したサイズに直線を合わせて、その端点を返す (描画用途) - /// - /// 合わせこむサイズの幅 - /// 合わせこむサイズの高さ - /// 端点1つ目 - /// 端点2つ目 -#else /// /// Fits this line to the specified size (for drawing) /// @@ -205,7 +132,6 @@ public double Distance(double x, double y) /// Height of fit size /// 1st edge point of fitted line /// 2nd edge point of fitted line -#endif public void FitSize(int width, int height, out Point pt1, out Point pt2) { double t = (width + height); @@ -220,6 +146,7 @@ public void FitSize(int width, int height, out Point pt1, out Point pt2) Y = (int)Math.Round(Y1 + Vy * t) }; } + #endregion } } \ No newline at end of file diff --git a/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs b/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs index c155ff9f7..8e9d7784a 100644 --- a/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs +++ b/src/OpenCvSharp/Modules/imgproc/Model/Line3D.cs @@ -10,32 +10,32 @@ public class Line3D /// /// The X component of the normalized vector collinear to the line /// - public double Vx { get; set; } + public double Vx { get; } /// /// The Y component of the normalized vector collinear to the line /// - public double Vy { get; set; } + public double Vy { get; } /// /// The Z component of the normalized vector collinear to the line /// - public double Vz { get; set; } + public double Vz { get; } /// /// X-coordinate of some point on the line /// - public double X1 { get; set; } + public double X1 { get; } /// /// Y-coordinate of some point on the line /// - public double Y1 { get; set; } + public double Y1 { get; } /// /// Z-coordinate of some point on the line /// - public double Z1 { get; set; } + public double Z1 { get; } /// /// Initializes this object diff --git a/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPoint.cs b/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPoint.cs index 953c8880c..8e33ad1f0 100644 --- a/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPoint.cs +++ b/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPoint.cs @@ -1,127 +1,65 @@ using System; using System.Runtime.InteropServices; -#pragma warning disable CA1051 - namespace OpenCvSharp { -#if LANG_JP - /// - /// cvHoughLines2で得られる、両端の点で表現される線分 - /// -#else /// /// Line segment structure retrieved from cvHoughLines2 /// -#endif [Serializable] [StructLayout(LayoutKind.Sequential)] public struct LineSegmentPoint : IEquatable { - #region Fields - -#if LANG_JP - /// - /// 1つ目の点 - /// -#else /// /// 1st Point /// -#endif public Point P1; -#if LANG_JP - /// - /// 2つ目の点 - /// -#else /// /// 2nd Point /// -#endif public Point P2; - #endregion - - #region Init - -#if LANG_JP - /// - /// 初期化 - /// - /// 1つ目の点 - /// 2つ目の点 -#else /// /// Constructor /// /// 1st Point /// 2nd Point -#endif public LineSegmentPoint(Point p1, Point p2) { P1 = p1; P2 = p2; } - - #endregion - + #region Operators -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else /// /// Specifies whether this object contains the same members as the specified Object. /// /// The Object to test. /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif public bool Equals(LineSegmentPoint obj) { return (P1 == obj.P1 && P2 == obj.P2); } -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(LineSegmentPoint lhs, LineSegmentPoint rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(LineSegmentPoint lhs, LineSegmentPoint rhs) { return !lhs.Equals(rhs); @@ -131,51 +69,29 @@ public bool Equals(LineSegmentPoint obj) #region Overrided methods -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else /// /// Specifies whether this object contains the same members as the specified Object. /// /// The Object to test. /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif public override bool Equals(object? obj) { return base.Equals(obj); } -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else /// /// Returns a hash code for this object. /// /// An integer value that specifies a hash value for this object. -#endif public override int GetHashCode() { return P1.GetHashCode() + P2.GetHashCode(); } -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else /// /// Converts this object to a human readable string. /// /// A string that represents this object. -#endif public override string ToString() { return $"CvLineSegmentPoint (P1:{P1} P2:{P2})"; @@ -187,21 +103,12 @@ public override string ToString() #region Line and Line -#if LANG_JP - /// - /// 2直線の交点を求める (線分としてではなく直線として) - /// - /// - /// - /// -#else /// /// Calculates a intersection of the specified two lines /// /// /// /// -#endif public static Point? LineIntersection(LineSegmentPoint line1, LineSegmentPoint line2) { var x1 = line1.P1.X; @@ -231,19 +138,11 @@ public override string ToString() }; } -#if LANG_JP - /// - /// 2直線の交点を求める (線分としてではなく直線として) - /// - /// - /// -#else /// /// Calculates a intersection of the specified two lines /// /// /// -#endif public Point? LineIntersection(LineSegmentPoint line) { return LineIntersection(this, line); @@ -252,22 +151,13 @@ public override string ToString() #endregion #region Segment and Segment - -#if LANG_JP - /// - /// 線分同士の交点を求める - /// - /// - /// - /// -#else + /// /// Calculates a intersection of the specified two segments /// /// /// /// -#endif public static Point? SegmentIntersection(LineSegmentPoint seg1, LineSegmentPoint seg2) { if (IntersectedSegments(seg1, seg2)) @@ -275,40 +165,23 @@ public override string ToString() else return null; } - -#if LANG_JP - /// - /// 線分同士の交点を求める - /// - /// - /// -#else + /// /// Calculates a intersection of the specified two segments /// /// /// -#endif public Point? SegmentIntersection(LineSegmentPoint seg) { return SegmentIntersection(this, seg); } - -#if LANG_JP - /// - /// 2つの線分が交差しているかどうかを返す - /// - /// - /// - /// -#else + /// /// Returns a boolean value indicating whether the specified two segments intersect. /// /// /// /// -#endif public static bool IntersectedSegments(LineSegmentPoint seg1, LineSegmentPoint seg2) { var p1 = seg1.P1; @@ -349,19 +222,11 @@ public static bool IntersectedSegments(LineSegmentPoint seg1, LineSegmentPoint s return true; } -#if LANG_JP - /// - /// 2つの線分が交差しているかどうかを返す - /// - /// - /// -#else /// /// Returns a boolean value indicating whether the specified two segments intersect. /// /// /// -#endif public bool IntersectedSegments(LineSegmentPoint seg) { return IntersectedSegments(this, seg); @@ -371,21 +236,12 @@ public bool IntersectedSegments(LineSegmentPoint seg) #region Line and Segment -#if LANG_JP - /// - /// 直線と線分が交差しているかを調べる - /// - /// 線分 - /// 直線 - /// -#else /// /// Returns a boolean value indicating whether a line and a segment intersect. /// /// Line /// Segment /// -#endif public static bool IntersectedLineAndSegment(LineSegmentPoint line, LineSegmentPoint seg) { var p1 = line.P1; @@ -400,21 +256,12 @@ public static bool IntersectedLineAndSegment(LineSegmentPoint line, LineSegmentP return true; } -#if LANG_JP - /// - /// 直線と線分の交点を求める - /// - /// - /// - /// -#else /// /// Calculates a intersection of a line and a segment /// /// /// /// -#endif public static Point? LineAndSegmentIntersection(LineSegmentPoint line, LineSegmentPoint seg) { if (IntersectedLineAndSegment(line, seg)) @@ -425,37 +272,21 @@ public static bool IntersectedLineAndSegment(LineSegmentPoint line, LineSegmentP #endregion -#if LANG_JP - /// - /// 2点間の距離を求める - /// - /// -#else /// /// /// /// -#endif public double Length() { return P1.DistanceTo(P2); } -#if LANG_JP - /// - /// この CvLineSegmentPoint を指定の量だけ平行移動する - /// - /// x 座標のオフセット量 - /// y 座標のオフセット量 - /// -#else /// /// Translates the Point by the specified amount. /// /// The amount to offset the x-coordinate. /// The amount to offset the y-coordinate. /// -#endif public void Offset(int x, int y) { P1.X += x; @@ -464,19 +295,11 @@ public void Offset(int x, int y) P2.Y += y; } -#if LANG_JP - /// - /// この CvLineSegmentPoint を指定の量だけ平行移動する - /// - /// オフセットに使用する CvPoint - /// -#else /// /// Translates the Point by the specified amount. /// /// The Point used offset this CvPoint. /// -#endif public void Offset(Point p) { Offset(p.X, p.Y); diff --git a/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPolar.cs b/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPolar.cs index d6d3aa1a2..c3885222a 100644 --- a/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPolar.cs +++ b/src/OpenCvSharp/Modules/imgproc/Model/LineSegmentPolar.cs @@ -1,173 +1,98 @@ using System; using System.Runtime.InteropServices; -#pragma warning disable CA1051 - namespace OpenCvSharp { -#if LANG_JP - /// - /// cvHoughLines2で得られる、極座標系で表現される線分 - /// -#else /// /// Polar line segment retrieved from cvHoughLines2 /// -#endif [Serializable] [StructLayout(LayoutKind.Sequential)] public struct LineSegmentPolar : IEquatable { - #region Fields -#if LANG_JP - /// - /// 線分の長さ - /// -#else /// /// Length of the line /// -#endif public float Rho; -#if LANG_JP - /// - /// 線分の角度(ラジアン) - /// -#else /// /// Angle of the line (radian) /// -#endif public float Theta; - #endregion - #region Init -#if LANG_JP - /// - /// 初期化 - /// - /// 線分の長さ - /// 線分の角度(ラジアン) -#else /// /// Constructor /// /// Length of the line /// Angle of the line (radian) -#endif public LineSegmentPolar(float rho, float theta) { Rho = rho; Theta = theta; } - #endregion #region Operators -#if LANG_JP - /// - /// 指定したオブジェクトと等しければtrueを返す - /// - /// 比較するオブジェクト - /// 型が同じで、メンバの値が等しければtrue -#else /// /// Specifies whether this object contains the same members as the specified Object. /// /// The Object to test. /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif public bool Equals(LineSegmentPolar obj) { return (Math.Abs(Rho - obj.Rho) < 1e-9 && Math.Abs(Theta - obj.Theta) < 1e-9); } -#if LANG_JP - /// - /// == 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しければtrue -#else /// /// Compares two CvPoint objects. The result specifies whether the members of each object are equal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are equal; otherwise, false. -#endif public static bool operator ==(LineSegmentPolar lhs, LineSegmentPolar rhs) { return lhs.Equals(rhs); } -#if LANG_JP - /// - /// != 演算子のオーバーロード - /// - /// 左辺値 - /// 右辺値 - /// 等しくなければtrue -#else + /// /// Compares two CvPoint objects. The result specifies whether the members of each object are unequal. /// /// A Point to compare. /// A Point to compare. /// This operator returns true if the members of left and right are unequal; otherwise, false. -#endif public static bool operator !=(LineSegmentPolar lhs, LineSegmentPolar rhs) { return !lhs.Equals(rhs); } + #endregion #region Overrided methods -#if LANG_JP - /// - /// Equalsのオーバーライド - /// - /// 比較するオブジェクト - /// -#else + /// /// Specifies whether this object contains the same members as the specified Object. /// /// The Object to test. /// This method returns true if obj is the same type as this object and has the same members as this object. -#endif public override bool Equals(object? obj) { return base.Equals(obj); } -#if LANG_JP - /// - /// GetHashCodeのオーバーライド - /// - /// このオブジェクトのハッシュ値を指定する整数値。 -#else + /// /// Returns a hash code for this object. /// /// An integer value that specifies a hash value for this object. -#endif public override int GetHashCode() { return Rho.GetHashCode() + Theta.GetHashCode(); } -#if LANG_JP - /// - /// 文字列形式を返す - /// - /// 文字列形式 -#else + /// /// Converts this object to a human readable string. /// /// A string that represents this object. -#endif public override string ToString() { return $"CvLineSegmentPolar (Rho:{Rho} Theta:{Theta})"; @@ -175,21 +100,13 @@ public override string ToString() #endregion #region Methods -#if LANG_JP - /// - /// 2直線の交点を求める - /// - /// - /// - /// -#else + /// /// Calculates a intersection of the specified two lines /// /// /// /// -#endif public static Point? LineIntersection(LineSegmentPolar line1, LineSegmentPolar line2) { var seg1 = line1.ToSegmentPoint(5000); @@ -197,37 +114,21 @@ public override string ToString() return LineSegmentPoint.LineIntersection(seg1, seg2); } -#if LANG_JP - /// - /// 2直線の交点を求める (線分としてではなく直線として) - /// - /// - /// -#else /// /// Calculates a intersection of the specified two lines /// /// /// -#endif public Point? LineIntersection(LineSegmentPolar line) { return LineIntersection(this, line); } -#if LANG_JP - /// - /// LineSegmentPointに変換する - /// - /// - /// -#else /// /// Convert To LineSegmentPoint /// /// /// -#endif public LineSegmentPoint ToSegmentPoint(double scale) { var cos = Math.Cos(Theta); @@ -239,21 +140,12 @@ public LineSegmentPoint ToSegmentPoint(double scale) return new LineSegmentPoint(p1, p2); } -#if LANG_JP - /// - /// 指定したx座標を両端とするような線分に変換する - /// - /// - /// - /// -#else /// /// Converts to a line segment with the specified x coordinates at both ends /// /// /// /// -#endif public LineSegmentPoint ToSegmentPointX(int x1, int x2) { if (x1 > x2) @@ -269,21 +161,12 @@ public LineSegmentPoint ToSegmentPointX(int x1, int x2) return new LineSegmentPoint(p1, p2); } -#if LANG_JP - /// - /// 指定したy座標を両端とするような線分に変換する - /// - /// - /// - /// -#else /// /// Converts to a line segment with the specified y coordinates at both ends /// /// /// /// -#endif public LineSegmentPoint ToSegmentPointY(int y1, int y2) { if (y1 > y2) @@ -299,19 +182,11 @@ public LineSegmentPoint ToSegmentPointY(int y1, int y2) return new LineSegmentPoint(p1, p2); } -#if LANG_JP - /// - /// 指定したy座標を通るときのx座標を求める - /// - /// - /// -#else /// /// /// /// /// -#endif public int? XPosOfLine(int y) { var axis = new LineSegmentPolar(y, (float)(Math.PI / 2)); // 垂線90度 = x軸に平行 @@ -319,25 +194,18 @@ public LineSegmentPoint ToSegmentPointY(int y1, int y2) return node?.X; } -#if LANG_JP - /// - /// 指定したx座標を通るときのy座標を求める - /// - /// - /// -#else /// /// /// /// /// -#endif public int? YPosOfLine(int x) { var axis = new LineSegmentPolar(x, 0); // 垂線0度 = y軸に平行 var node = LineIntersection(axis); return node?.Y; } -#endregion + + #endregion } } diff --git a/src/OpenCvSharp/Modules/imgproc/Subdiv2D.cs b/src/OpenCvSharp/Modules/imgproc/Subdiv2D.cs index ba4ab1e4a..e99a2be6c 100644 --- a/src/OpenCvSharp/Modules/imgproc/Subdiv2D.cs +++ b/src/OpenCvSharp/Modules/imgproc/Subdiv2D.cs @@ -9,15 +9,9 @@ namespace OpenCvSharp { -#if LANG_JP /// - /// + /// Planar Subdivision /// -#else - /// - /// - /// -#endif public class Subdiv2D : DisposableCvObject { #region Init and Disposal diff --git a/src/OpenCvSharp/Modules/ml/ANN_MLP.cs b/src/OpenCvSharp/Modules/ml/ANN_MLP.cs index 20d81253a..8e6a5910a 100644 --- a/src/OpenCvSharp/Modules/ml/ANN_MLP.cs +++ b/src/OpenCvSharp/Modules/ml/ANN_MLP.cs @@ -4,15 +4,9 @@ namespace OpenCvSharp.ML { -#if LANG_JP - /// - /// MLPモデルクラス - /// -#else /// /// Artificial Neural Networks - Multi-Layer Perceptrons. /// -#endif // ReSharper disable once InconsistentNaming public class ANN_MLP : StatModel { diff --git a/src/OpenCvSharp/Modules/ml/DTrees.cs b/src/OpenCvSharp/Modules/ml/DTrees.cs index e1e32de84..bc09f09fa 100644 --- a/src/OpenCvSharp/Modules/ml/DTrees.cs +++ b/src/OpenCvSharp/Modules/ml/DTrees.cs @@ -5,15 +5,9 @@ namespace OpenCvSharp.ML { -#if LANG_JP - /// - /// 決定木クラス - /// -#else /// /// Decision tree /// -#endif public class DTrees : StatModel { private Ptr? ptrObj; diff --git a/src/OpenCvSharp/Modules/ml/EM.cs b/src/OpenCvSharp/Modules/ml/EM.cs index b8bda0372..6cd401e25 100644 --- a/src/OpenCvSharp/Modules/ml/EM.cs +++ b/src/OpenCvSharp/Modules/ml/EM.cs @@ -6,15 +6,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// EMモデルクラス - /// -#else /// /// The class implements the Expectation Maximization algorithm. /// -#endif public class EM : Algorithm { private Ptr? ptrObj; @@ -450,24 +444,11 @@ public enum Types CovMatDefault = CovMatSpherical, } -#if LANG_JP - /// - /// アルゴリズムをスタートする最初のステップ - /// -#else /// /// The initial step the algorithm starts from /// -#endif public enum StartStep { -#if LANG_JP - /// - /// アルゴリズムはE-stepでスタートする. 少なくとも平均ベクトルの初期値 CvEMParams.Means が渡されなければならない. - /// オプションとして,ユーザは重み(CvEMParams.Weights)と/または共変動行列(CvEMParams.Covs)を与えることもできる. - /// [CvEM::START_E_STEP] - /// -#else /// /// The algorithm starts with E-step. /// At least, the initial values of mean vectors, CvEMParams.Means must be passed. @@ -475,31 +456,18 @@ public enum StartStep /// and/or covariation matrices (CvEMParams.Covs). /// [CvEM::START_E_STEP] /// -#endif E = 1, -#if LANG_JP - /// - /// アルゴリズムはM-stepでスタートする.初期確率 p_i,k が与えられなければならない. - /// [CvEM::START_M_STEP] - /// -#else + /// /// The algorithm starts with M-step. The initial probabilities p_i,k must be provided. /// [CvEM::START_M_STEP] /// -#endif M = 2, -#if LANG_JP - /// - /// ユーザから必要な値が指定されない場合,k-meansアルゴリズムが混合分布パラメータの初期値推定に用いられる. - /// [CvEM::START_AUTO_STEP] - /// -#else + /// /// No values are required from the user, k-means algorithm is used to estimate initial mixtures parameters. /// [CvEM::START_AUTO_STEP] /// -#endif Auto = 0, } diff --git a/src/OpenCvSharp/Modules/ml/KNearest.cs b/src/OpenCvSharp/Modules/ml/KNearest.cs index 85eefb002..e4c3bb9c2 100644 --- a/src/OpenCvSharp/Modules/ml/KNearest.cs +++ b/src/OpenCvSharp/Modules/ml/KNearest.cs @@ -3,15 +3,9 @@ namespace OpenCvSharp.ML { -#if LANG_JP - /// - /// K近傍法モデルクラス - /// -#else /// /// K nearest neighbors classifier /// -#endif public class KNearest : StatModel { private Ptr? ptrObj; diff --git a/src/OpenCvSharp/Modules/ml/NormalBayesClassifier.cs b/src/OpenCvSharp/Modules/ml/NormalBayesClassifier.cs index 16d1f5a70..c11981b94 100644 --- a/src/OpenCvSharp/Modules/ml/NormalBayesClassifier.cs +++ b/src/OpenCvSharp/Modules/ml/NormalBayesClassifier.cs @@ -3,15 +3,9 @@ namespace OpenCvSharp.ML { -#if LANG_JP - /// - /// 正規分布データに対するベイズ分類器クラス - /// -#else /// /// Bayes classifier for normally distributed data /// -#endif public class NormalBayesClassifier : StatModel { private Ptr? ptrObj; diff --git a/src/OpenCvSharp/Modules/ml/RTrees.cs b/src/OpenCvSharp/Modules/ml/RTrees.cs index a3081b756..40c61728b 100644 --- a/src/OpenCvSharp/Modules/ml/RTrees.cs +++ b/src/OpenCvSharp/Modules/ml/RTrees.cs @@ -3,15 +3,9 @@ namespace OpenCvSharp.ML { -#if LANG_JP - /// - /// ランダムツリークラス - /// -#else /// /// The class implements the random forest predictor. /// -#endif public class RTrees : DTrees { private Ptr? ptrObj; diff --git a/src/OpenCvSharp/Modules/ml/SVM.cs b/src/OpenCvSharp/Modules/ml/SVM.cs index 6da5e4e2e..aa9de6990 100644 --- a/src/OpenCvSharp/Modules/ml/SVM.cs +++ b/src/OpenCvSharp/Modules/ml/SVM.cs @@ -5,16 +5,9 @@ namespace OpenCvSharp.ML { // ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// SVM model classifier - /// -#else /// /// Support Vector Machines /// -#endif - public class SVM : StatModel { private Ptr? ptrObj; diff --git a/src/OpenCvSharp/Modules/objdetect/CascadeClassifier.cs b/src/OpenCvSharp/Modules/objdetect/CascadeClassifier.cs index 4ae7a4cd7..5843a690e 100644 --- a/src/OpenCvSharp/Modules/objdetect/CascadeClassifier.cs +++ b/src/OpenCvSharp/Modules/objdetect/CascadeClassifier.cs @@ -102,7 +102,7 @@ public virtual Rect[] DetectMultiScale( Mat image, double scaleFactor = 1.1, int minNeighbors = 3, - HaarDetectionType flags = 0, + HaarDetectionTypes flags = 0, Size? minSize = null, Size? maxSize = null) { @@ -145,7 +145,7 @@ public virtual Rect[] DetectMultiScale( out double[] levelWeights, double scaleFactor = 1.1, int minNeighbors = 3, - HaarDetectionType flags = 0, + HaarDetectionTypes flags = 0, Size? minSize = null, Size? maxSize = null, bool outputRejectLevels = false) diff --git a/src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionType.cs b/src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionType.cs deleted file mode 100644 index 654df951c..000000000 --- a/src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionType.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; - -namespace OpenCvSharp -{ -#if LANG_JP - /// - /// cvHaarDetectObjectsの処理モード - /// -#else - /// - /// Modes of operation for cvHaarDetectObjects - /// -#endif - [Flags] - public enum HaarDetectionType - { -#if LANG_JP - /// - /// これがセットされると,関数は Canny エッジ検出器を 非常に多くのエッジを含む(あるいは非常に少ないエッジしか含まない) 画像領域を, - /// 探索オブジェクトを含まない領域と見なして棄却する. 顔検出用には特別な閾値が調整されており,この場合,枝刈りにより処理が 高速化される. - /// [CV_HAAR_DO_CANNY_PRUNING] - /// -#else - /// - /// If it is set, the function uses Canny edge detector to reject some image regions that contain too few or too much edges and thus can not contain the searched object. - /// The particular threshold values are tuned for face detection and in this case the pruning speeds up the processing. - /// [CV_HAAR_DO_CANNY_PRUNING] - /// -#endif - DoCannyPruning = 1, - - -#if LANG_JP - /// - /// スケーリングされる度に,関数は, 分類カスケード中の特徴の座標系を 「拡大」するのではなく,逆に画像を縮小する. - /// 現在は,単体でのみ用いることができるオプションである. つまり,このフラグは他のものと併用はできない. - /// [CV_HAAR_SCALE_IMAGE] - /// -#else - /// - /// For each scale factor used the function will downscale the image rather than "zoom" the feature coordinates in the classifier cascade. - /// Currently, the option can only be used alone, i.e. the flag can not be set together with the others. - /// [CV_HAAR_SCALE_IMAGE] - /// -#endif - ScaleImage = 2, - - -#if LANG_JP - /// - /// これがセットされると,関数は,(もし存在すれば)画像中の最大のオブジェクトを検出する. つまり,出力シーケンスは一つ(あるいは 0)のエレメントを持つ. - /// [CV_HAAR_FIND_BIGGEST_OBJECT] - /// -#else - /// - /// If it is set, the function finds the largest object (if any) in the image. That is, the output sequence will contain one (or zero) element(s). - /// [CV_HAAR_FIND_BIGGEST_OBJECT] - /// -#endif - FindBiggestObject = 4, - - -#if LANG_JP - /// - /// FindBiggestObject がセットされており,min_neighbors > 0 である場合にのみ利用されるべきである. - /// このフラグがセットされると,関数は,現在のスケールにおいて, オブジェクトが検出(かつ,その近傍に充分に候補が検出)された後に, - /// それより小さいサイズの候補を探索しなくなる. min_neighbors が固定されていると, 大抵の場合,このモードは通常のシングルオブジェクトモード - /// (flags=FindBiggestObject)よりも不正確な(少しだけ大きい)オブジェクト矩形を返す. しかし,このモードはずっと高速であり,最大で10倍程度の速度差になる. - /// 正確さを増すために,min_neighbors に大き な値を指定することができる. - /// [CV_HAAR_DO_ROUGH_SEARCH] - /// -#else - /// - /// It should be used only when FindBiggestObject is set and min_neighbors > 0. - /// If the flag is set, the function does not look for candidates of a smaller size - /// as soon as it has found the object (with enough neighbor candidates) at the current scale. - /// Typically, when min_neighbors is fixed, the mode yields less accurate (a bit larger) object rectangle - /// than the regular single-object mode (flags=FindBiggestObject), - /// but it is much faster, up to an order of magnitude. A greater value of min_neighbors may be specified to improve the accuracy. - /// [CV_HAAR_DO_ROUGH_SEARCH] - /// -#endif - DoRoughSearch = 8, - } -} diff --git a/src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionTypes.cs b/src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionTypes.cs new file mode 100644 index 000000000..ab0f3c005 --- /dev/null +++ b/src/OpenCvSharp/Modules/objdetect/Enum/HaarDetectionTypes.cs @@ -0,0 +1,42 @@ +using System; + +namespace OpenCvSharp +{ + /// + /// Modes of operation for cvHaarDetectObjects + /// + [Flags] + public enum HaarDetectionTypes + { + /// + /// If it is set, the function uses Canny edge detector to reject some image regions that contain too few or too much edges and thus can not contain the searched object. + /// The particular threshold values are tuned for face detection and in this case the pruning speeds up the processing. + /// [CV_HAAR_DO_CANNY_PRUNING] + /// + DoCannyPruning = 1, + + /// + /// For each scale factor used the function will downscale the image rather than "zoom" the feature coordinates in the classifier cascade. + /// Currently, the option can only be used alone, i.e. the flag can not be set together with the others. + /// [CV_HAAR_SCALE_IMAGE] + /// + ScaleImage = 2, + + /// + /// If it is set, the function finds the largest object (if any) in the image. That is, the output sequence will contain one (or zero) element(s). + /// [CV_HAAR_FIND_BIGGEST_OBJECT] + /// + FindBiggestObject = 4, + + /// + /// It should be used only when FindBiggestObject is set and min_neighbors > 0. + /// If the flag is set, the function does not look for candidates of a smaller size + /// as soon as it has found the object (with enough neighbor candidates) at the current scale. + /// Typically, when min_neighbors is fixed, the mode yields less accurate (a bit larger) object rectangle + /// than the regular single-object mode (flags=FindBiggestObject), + /// but it is much faster, up to an order of magnitude. A greater value of min_neighbors may be specified to improve the accuracy. + /// [CV_HAAR_DO_ROUGH_SEARCH] + /// + DoRoughSearch = 8, + } +} diff --git a/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs b/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs index b85460397..ea0c25b63 100644 --- a/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs +++ b/src/OpenCvSharp/Modules/objdetect/HOGDescriptor.cs @@ -7,15 +7,9 @@ namespace OpenCvSharp { -#if LANG_JP /// /// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector /// -#else - /// - /// HOG (Histogram-of-Oriented-Gradients) Descriptor and Object Detector - /// -#endif public class HOGDescriptor : DisposableCvObject { #region Fields @@ -1354,37 +1348,15 @@ public class HOGDescriptor : DisposableCvObject #region Init and Disposal -#if LANG_JP - /// - /// HOG ディスクリプタおよび検出器を作成します - /// -#else /// /// Default constructor /// -#endif public HOGDescriptor() { NativeMethods.HandleException( NativeMethods.objdetect_HOGDescriptor_new1(out ptr)); } -#if LANG_JP - /// - /// HOG ディスクリプタおよび検出器を作成します - /// - /// 検出窓サイズ.ブロックのサイズと移動量に合わせる必要があります. - /// ピクセル単位で表されるブロックサイズ.セルサイズに合わせる必要があります. - /// ブロックの移動量.セルサイズの倍数でなければいけません. - /// セルサイズ. - /// ビンの個数. - /// - /// ガウシアン平滑化窓パラメータ. - /// - /// L2-Hys 正規化縮小処理の閾値. - /// 前処理としてガンマ補正を行うか否か,を指定します. - /// 検出窓拡大回数の最大値 -#else /// /// Creates the HOG descriptor and detector. /// @@ -1399,7 +1371,6 @@ public HOGDescriptor() /// L2-Hys normalization method shrinkage. /// Flag to specify whether the gamma correction preprocessing is required or not. /// Maximum number of detection window increases. -#endif public HOGDescriptor( Size? winSize = null, Size? blockSize = null, @@ -1695,17 +1666,10 @@ public bool SignedGradient #region Methods -#if LANG_JP - /// - /// (デフォルトの窓サイズで)人検出用に学習された分類器の係数を返します. - /// - /// -#else /// /// Returns coefficients of the classifier trained for people detection (for default window size). /// /// -#endif public static float[] GetDefaultPeopleDetector() { return DefaultPeopleDetector; @@ -1721,17 +1685,10 @@ public static float[] GetDaimlerPeopleDetector() return DaimlerPeopleDetector; } -#if LANG_JP - /// - /// 線形SVM分類器に,係数をセットします. - /// - /// coefficients for the linear SVM classifier. -#else /// /// Sets coefficients for the linear SVM classifier. /// /// coefficients for the linear SVM classifier. -#endif public virtual void SetSVMDetector(float[] svmDetector) { ThrowIfDisposed(); diff --git a/src/OpenCvSharp/Modules/objdetect/HistogramNormType.cs b/src/OpenCvSharp/Modules/objdetect/HistogramNormType.cs index dcc3e1560..cfff4a6ae 100644 --- a/src/OpenCvSharp/Modules/objdetect/HistogramNormType.cs +++ b/src/OpenCvSharp/Modules/objdetect/HistogramNormType.cs @@ -1,30 +1,11 @@ namespace OpenCvSharp { - -#if LANG_JP - /// - /// - /// -#else - /// - /// - /// -#endif public enum HistogramNormType { -#if LANG_JP /// /// /// [HOGDescriptor::L2Hys] /// -#else - /// - /// - /// [HOGDescriptor::L2Hys] - /// -#endif L2Hys = HOGDescriptor.L2Hys, } } - - diff --git a/src/OpenCvSharp/Modules/photo/InpaintMethod.cs b/src/OpenCvSharp/Modules/photo/InpaintMethod.cs index 7e27e1cbd..a3054da07 100644 --- a/src/OpenCvSharp/Modules/photo/InpaintMethod.cs +++ b/src/OpenCvSharp/Modules/photo/InpaintMethod.cs @@ -1,43 +1,19 @@ - -namespace OpenCvSharp +namespace OpenCvSharp { -#if LANG_JP - /// - /// cvInpaintの修復方法 - /// -#else /// /// The inpainting method /// -#endif public enum InpaintMethod { -#if LANG_JP - /// - /// ナビエ・ストークス(Navier-Stokes)ベースの手法 - /// [CV_INPAINT_NS] - /// -#else /// /// Navier-Stokes based method. - /// [CV_INPAINT_NS] /// -#endif -// ReSharper disable once InconsistentNaming + // ReSharper disable once InconsistentNaming NS = 0, - -#if LANG_JP - /// - /// Alexandru Teleaによる手法 - /// [CV_INPAINT_TELEA] - /// -#else /// /// The method by Alexandru Telea - /// [CV_INPAINT_TELEA] /// -#endif Telea = 1, } } diff --git a/src/OpenCvSharp/Modules/videoio/Enum/CameraChannels.cs b/src/OpenCvSharp/Modules/videoio/Enum/CameraChannels.cs index bdd0fe634..0195d2df3 100644 --- a/src/OpenCvSharp/Modules/videoio/Enum/CameraChannels.cs +++ b/src/OpenCvSharp/Modules/videoio/Enum/CameraChannels.cs @@ -3,15 +3,9 @@ namespace OpenCvSharp { // ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// マルチヘッドカメラから取得する画像のチャネル - /// -#else /// /// channel indices for multi-head camera live streams /// -#endif public enum CameraChannels { // Data given from depth generator. diff --git a/src/OpenCvSharp/Modules/videoio/Enum/CapturePosRatio.cs b/src/OpenCvSharp/Modules/videoio/Enum/CapturePosRatio.cs index 446bb67d4..122a2141d 100644 --- a/src/OpenCvSharp/Modules/videoio/Enum/CapturePosRatio.cs +++ b/src/OpenCvSharp/Modules/videoio/Enum/CapturePosRatio.cs @@ -1,39 +1,18 @@ - -#pragma warning disable 1591 - -namespace OpenCvSharp +namespace OpenCvSharp { -#if LANG_JP - /// - /// ビデオファイル内の相対的な位置 - /// -#else /// /// Position in relative units /// -#endif public enum CapturePosAviRatio { -#if LANG_JP - /// - /// ファイルの最初 - /// -#else /// /// Start of the file /// -#endif Start = 0, -#if LANG_JP - /// - /// ファイルの最後 - /// -#else /// /// End of the file /// -#endif End = 1, } } diff --git a/src/OpenCvSharp/Modules/videoio/Enum/CaptureType.cs b/src/OpenCvSharp/Modules/videoio/Enum/CaptureType.cs index 96a11a37f..9642cea6b 100644 --- a/src/OpenCvSharp/Modules/videoio/Enum/CaptureType.cs +++ b/src/OpenCvSharp/Modules/videoio/Enum/CaptureType.cs @@ -1,41 +1,20 @@ - -namespace OpenCvSharp +namespace OpenCvSharp { -#if LANG_JP - /// - /// CvCaptureのキャプチャタイプ(カメラorファイル) - /// -#else /// /// Capture type of CvCapture (Camera or AVI file) /// -#endif public enum CaptureType { -#if LANG_JP - /// - /// AVIファイルからのキャプチャ - /// -#else /// /// Captures from an AVI file /// -#endif File, - -#if LANG_JP - /// - /// カメラからのキャプチャ - /// -#else /// /// Captures from digital camera /// -#endif Camera, - - + /// /// /// diff --git a/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs index ce29663c2..e0b93a346 100644 --- a/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs +++ b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureAPIs.cs @@ -1,4 +1,6 @@ -#pragma warning disable CA1707 // Underscore +using System.Diagnostics.CodeAnalysis; + +#pragma warning disable CA1707 // Underscore namespace OpenCvSharp { @@ -6,15 +8,13 @@ namespace OpenCvSharp // ReSharper disable IdentifierTypo // ReSharper disable CommentTypo -#if LANG_JP - /// - /// カメラキャプチャの初期化に用いるカメラのデバイス - /// -#else /// /// Camera device types /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/videoio/include/opencv2/videoio.hpp#L89 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum VideoCaptureAPIs { /// diff --git a/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureProperties.cs b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureProperties.cs index 7b4b3c710..c330f928d 100644 --- a/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureProperties.cs +++ b/src/OpenCvSharp/Modules/videoio/Enum/VideoCaptureProperties.cs @@ -1,230 +1,114 @@ -namespace OpenCvSharp +using System.Diagnostics.CodeAnalysis; + +namespace OpenCvSharp { // ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// CvCaptureのプロパティID - /// -#else /// /// Property identifiers for CvCapture /// -#endif + /// + /// https://github.com/opencv/opencv/blob/d3bc563c6e01c2bc153f23e7393322a95c7d3974/modules/videoio/include/opencv2/videoio.hpp#L133 + /// + [SuppressMessage("Microsoft.Design", "CA1717: Only FlagsAttribute enums should have plural names")] public enum VideoCaptureProperties { #region Basic -#if LANG_JP - /// - /// ファイル中の現在の位置(ミリ秒単位),あるいはビデオキャプチャのタイムスタンプ値 - /// -#else /// /// Position in milliseconds from the file beginning /// -#endif PosMsec = 0, - -#if LANG_JP - /// - /// 次にデコード/キャプチャされるフレームのインデックス.0 から始まる - /// -#else /// /// Position in frames (only for video files) /// -#endif PosFrames = 1, -#if LANG_JP - /// - /// ビデオファイル内の相対的な位置 (0 - ファイルの最初,1 - ファイルの最後) - /// -#else /// /// Position in relative units (0 - start of the file, 1 - end of the file) /// -#endif PosAviRatio = 2, -#if LANG_JP - /// - /// ビデオストリーム中のフレームの幅 - /// -#else /// /// Width of frames in the video stream (only for cameras) /// -#endif FrameWidth = 3, -#if LANG_JP - /// - /// ビデオストリーム中のフレームの高さ - /// -#else /// /// Height of frames in the video stream (only for cameras) /// -#endif FrameHeight = 4, -#if LANG_JP - /// - /// フレームレート - /// -#else /// /// Frame rate (only for cameras) /// -#endif Fps = 5, -#if LANG_JP - /// - /// コーデックを表す 4 文字 - /// -#else /// /// 4-character code of codec (only for cameras). /// -#endif // ReSharper disable once InconsistentNaming FourCC = 6, -#if LANG_JP - /// - /// ビデオファイル中のフレーム数 - /// -#else /// /// Number of frames in the video stream /// -#endif FrameCount = 7, -#if LANG_JP - /// - /// retrieve() によって返されるMat オブジェクトのフォーマット. - /// -#else /// /// The format of the Mat objects returned by retrieve() /// -#endif Format = 8, -#if LANG_JP - /// - /// 現在のキャプチャモードを表す,バックエンド固有の値. - /// -#else /// /// A backend-specific value indicating the current capture mode /// -#endif Mode = 9, -#if LANG_JP - /// - /// 明度 - /// -#else /// /// Brightness of image (only for cameras) /// -#endif Brightness = 10, - -#if LANG_JP - /// - /// コントラスト - /// -#else /// /// contrast of image (only for cameras) /// -#endif Contrast = 11, -#if LANG_JP - /// - /// 彩度 - /// -#else /// /// Saturation of image (only for cameras) /// -#endif Saturation = 12, - -#if LANG_JP - /// - /// 色相 - /// -#else /// /// hue of image (only for cameras) /// -#endif Hue = 13, - -#if LANG_JP - /// - /// 画像のゲイン(カメラの場合のみ). - /// -#else /// /// Gain of the image (only for cameras) /// -#endif Gain = 14, - -#if LANG_JP - /// - /// 露出(カメラの場合のみ). - /// -#else /// /// Exposure (only for cameras) /// -#endif Exposure = 15, - -#if LANG_JP - /// - /// 画像がRGBに変換されるか否かを表す,ブール値のフラグ. - /// -#else /// /// Boolean flags indicating whether images should be converted to RGB /// -#endif ConvertRgb = 16, - /// /// /// WhiteBalanceBlueU = 17, - -#if LANG_JP - /// - /// TOWRITE(注意:現在のところ,DC1394 v 2.x バックエンドでのみサポートされます). - /// -#else /// /// TOWRITE (note: only supported by DC1394 v 2.x backend currently) /// -#endif Rectification = 18, /// diff --git a/src/OpenCvSharp/Modules/videoio/VideoCapture.cs b/src/OpenCvSharp/Modules/videoio/VideoCapture.cs index fdc9a561a..aea314156 100644 --- a/src/OpenCvSharp/Modules/videoio/VideoCapture.cs +++ b/src/OpenCvSharp/Modules/videoio/VideoCapture.cs @@ -7,42 +7,23 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// ビデオキャプチャ - /// -#else /// /// Video capturing class /// -#endif public class VideoCapture : DisposableCvObject { -#if LANG_JP - /// - /// キャプチャの種類 (File or Camera) - /// -#else /// /// Capture type (File or Camera) /// -#endif private CaptureType captureType; #region Init and Disposal -#if LANG_JP - /// - /// 空の状態で初期化. 後でOpenが必要. - /// - /// -#else /// /// Initializes empty capture. /// To use this, you should call Open. /// /// -#endif public VideoCapture() { NativeMethods.HandleException( @@ -152,44 +133,24 @@ protected override void DisposeUnmanaged() #region Properties #region Basic -#if LANG_JP - /// - /// キャプチャの種類 (File or Camera) - /// -#else + /// /// Gets the capture type (File or Camera) /// -#endif - public CaptureType CaptureType - { - get { return captureType; } - } + public CaptureType CaptureType => captureType; -#if LANG_JP - /// - /// ファイル中の現在の位置(ミリ秒単位),あるいはビデオキャプチャのタイムスタンプ値を取得・設定する - /// -#else /// /// Gets or sets film current position in milliseconds or video capture timestamp /// -#endif public int PosMsec { get => (int)Get(VideoCaptureProperties.PosMsec); set => Set(VideoCaptureProperties.PosMsec, value); } -#if LANG_JP - /// - /// 次にデコード/キャプチャされるフレームのインデックス(0からはじまる)を取得・設定する(設定はビデオファイルのみ) - /// -#else /// /// Gets or sets 0-based index of the frame to be decoded/captured next /// -#endif public int PosFrames { get => (int)Get(VideoCaptureProperties.PosFrames); @@ -200,16 +161,10 @@ public int PosFrames Set(VideoCaptureProperties.PosFrames, value); } } - -#if LANG_JP - /// - /// ビデオファイル内の相対的な位置を取得・設定する(設定はビデオファイルのみ) - /// -#else + /// /// Gets or sets relative position of video file /// -#endif public CapturePosAviRatio PosAviRatio { get => (CapturePosAviRatio)(int)Get(VideoCaptureProperties.PosAviRatio); @@ -221,15 +176,9 @@ public CapturePosAviRatio PosAviRatio } } -#if LANG_JP - /// - /// ビデオストリーム中のフレームの幅を取得・設定する(設定はカメラのみ) - /// -#else /// /// Gets or sets width of frames in the video stream /// -#endif public int FrameWidth { get => (int)Get(VideoCaptureProperties.FrameWidth); @@ -241,15 +190,9 @@ public int FrameWidth } } -#if LANG_JP - /// - /// ビデオストリーム中のフレームの高さを取得・設定する(設定はカメラのみ) - /// -#else /// /// Gets or sets height of frames in the video stream /// -#endif public int FrameHeight { get => (int)Get(VideoCaptureProperties.FrameHeight); @@ -261,15 +204,9 @@ public int FrameHeight } } -#if LANG_JP - /// - /// フレームレートを取得・設定する(設定はカメラのみ) - /// -#else /// /// Gets or sets frame rate /// -#endif public double Fps { get => Get(VideoCaptureProperties.Fps); @@ -281,20 +218,11 @@ public double Fps } } -#if LANG_JP - /// - /// コーデックを表す4文字を取得・設定する(設定はカメラのみ). - /// 例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// -#else /// /// Gets or sets 4-character code of codec /// -#endif -// ReSharper disable InconsistentNaming + // ReSharper disable once InconsistentNaming public string FourCC -// ReSharper restore InconsistentNaming { get { @@ -317,15 +245,9 @@ public string FourCC } } -#if LANG_JP - /// - /// ビデオファイル中のフレーム数を取得する - /// -#else /// /// Gets number of frames in video file /// -#endif public int FrameCount { get @@ -334,15 +256,9 @@ public int FrameCount } } -#if LANG_JP - /// - /// 明度を取得・設定する - /// -#else /// /// Gets or sets brightness of image (only for cameras) /// -#endif public double Brightness { get @@ -358,16 +274,10 @@ public double Brightness Set(VideoCaptureProperties.Brightness, value); } } - -#if LANG_JP - /// - /// コンストラストを取得・設定する - /// -#else + /// /// Gets or sets contrast of image (only for cameras) /// -#endif public double Contrast { get @@ -383,16 +293,10 @@ public double Contrast Set(VideoCaptureProperties.Contrast, value); } } - -#if LANG_JP - /// - /// 彩度を取得・設定する - /// -#else + /// /// Gets or sets saturation of image (only for cameras) /// -#endif public double Saturation { get @@ -408,16 +312,10 @@ public double Saturation Set(VideoCaptureProperties.Saturation, value); } } - -#if LANG_JP - /// - /// 色相を取得・設定する - /// -#else + /// /// Gets or sets hue of image (only for cameras) /// -#endif public double Hue { get @@ -434,45 +332,27 @@ public double Hue } } -#if LANG_JP - /// - /// retrieve() によって返されるMat オブジェクトのフォーマット. - /// -#else /// /// The format of the Mat objects returned by retrieve() /// -#endif public int Format { get => (int)Get(VideoCaptureProperties.Format); set => Set(VideoCaptureProperties.Format, value); } -#if LANG_JP - /// - /// 現在のキャプチャモードを表す,バックエンド固有の値. - /// -#else /// /// A backend-specific value indicating the current capture mode /// -#endif public int Mode { get => (int)Get(VideoCaptureProperties.Mode); set => Set(VideoCaptureProperties.Mode, value); } - -#if LANG_JP - /// - /// 画像のゲイン(カメラの場合のみ). - /// -#else + /// /// Gain of the image (only for cameras) /// -#endif public double Gain { get @@ -489,16 +369,9 @@ public double Gain } } - -#if LANG_JP - /// - /// 露出(カメラの場合のみ). - /// -#else /// /// Exposure (only for cameras) /// -#endif public double Exposure { get @@ -515,15 +388,9 @@ public double Exposure } } -#if LANG_JP - /// - /// 画像がRGBに変換されるか否かを表す,ブール値のフラグ. - /// -#else /// /// Boolean flags indicating whether images should be converted to RGB /// -#endif public bool ConvertRgb { get => (int)Get(VideoCaptureProperties.ConvertRgb) != 0; @@ -539,16 +406,9 @@ public double WhiteBalanceBlueU set => Set(VideoCaptureProperties.WhiteBalanceBlueU, value); } - -#if LANG_JP - /// - /// TOWRITE(注意:現在のところ,DC1394 v 2.x バックエンドでのみサポートされます). - /// -#else /// /// TOWRITE (note: only supported by DC1394 v 2.x backend currently) /// -#endif public double Rectification { get => Get(VideoCaptureProperties.Rectification); @@ -742,565 +602,335 @@ public bool AutoFocus #region OpenNI // Properties of cameras available through OpenNI interfaces // ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// - /// [CV_CAP_PROP_OPENNI_OUTPUT_MODE] - /// -#else + /// /// /// [CV_CAP_PROP_OPENNI_OUTPUT_MODE] /// -#endif public double OpenNI_OutputMode { get => Get(VideoCaptureProperties.OpenNI_OutputMode); set => Set(VideoCaptureProperties.OpenNI_OutputMode, value); } -#if LANG_JP - /// - /// in mm - /// [CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH] - /// -#else /// /// in mm /// [CV_CAP_PROP_OPENNI_FRAME_MAX_DEPTH] /// -#endif public double OpenNI_FrameMaxDepth { get => Get(VideoCaptureProperties.OpenNI_FrameMaxDepth); set => Set(VideoCaptureProperties.OpenNI_FrameMaxDepth, value); } -#if LANG_JP - /// - /// in mm - /// [CV_CAP_PROP_OPENNI_BASELINE] - /// -#else /// /// in mm /// [CV_CAP_PROP_OPENNI_BASELINE] /// -#endif public double OpenNI_Baseline { get => Get(VideoCaptureProperties.OpenNI_Baseline); set => Set(VideoCaptureProperties.OpenNI_Baseline, value); } -#if LANG_JP - /// - /// in pixels - /// [CV_CAP_PROP_OPENNI_FOCAL_LENGTH] - /// -#else /// /// in pixels /// [CV_CAP_PROP_OPENNI_FOCAL_LENGTH] /// -#endif public double OpenNI_FocalLength { get => Get(VideoCaptureProperties.OpenNI_FocalLength); set => Set(VideoCaptureProperties.OpenNI_FocalLength, value); } -#if LANG_JP - /// - /// flag that synchronizes the remapping depth map to image map - /// by changing depth generator's view point (if the flag is "on") or - /// sets this view point to its normal one (if the flag is "off"). - /// [CV_CAP_PROP_OPENNI_REGISTRATION] - /// -#else /// /// flag that synchronizes the remapping depth map to image map /// by changing depth generator's view point (if the flag is "on") or /// sets this view point to its normal one (if the flag is "off"). /// [CV_CAP_PROP_OPENNI_REGISTRATION] /// -#endif public double OpenNI_Registration { get => Get(VideoCaptureProperties.OpenNI_Registration); set => Set(VideoCaptureProperties.OpenNI_Registration, value); } - -#if LANG_JP - /// - /// - /// [CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE] - /// -#else + /// /// /// [CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE] /// -#endif public double OpenNI_ImageGeneratorOutputMode { get => Get(VideoCaptureProperties.OpenNI_ImageGeneratorOutputMode); set => Set(VideoCaptureProperties.OpenNI_ImageGeneratorOutputMode, value); } -#if LANG_JP /// /// /// [CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE] /// -#else - /// - /// - /// [CV_CAP_OPENNI_DEPTH_GENERATOR_BASELINE] - /// -#endif public double OpenNI_DepthGeneratorBaseline { get => Get(VideoCaptureProperties.OpenNI_DepthGeneratorBaseline); set => Set(VideoCaptureProperties.OpenNI_DepthGeneratorBaseline, value); } -#if LANG_JP - /// - /// - /// [CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH] - /// -#else /// /// /// [CV_CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH] /// -#endif public double OpenNI_DepthGeneratorFocalLength { get => Get(VideoCaptureProperties.OpenNI_DepthGeneratorFocalLength); set => Set(VideoCaptureProperties.OpenNI_DepthGeneratorFocalLength, value); } -#if LANG_JP - /// - /// - /// [CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON] - /// -#else /// /// /// [CV_CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON] /// -#endif public double OpenNI_DepthGeneratorRegistrationON { get => Get(VideoCaptureProperties.OpenNI_DepthGeneratorRegistrationON); set => Set(VideoCaptureProperties.OpenNI_DepthGeneratorRegistrationON, value); } -// ReSharper restore InconsistentNaming + // ReSharper restore InconsistentNaming #endregion #region GStreamer // Properties of cameras available through GStreamer interface -#if LANG_JP /// /// default is 1 /// [CV_CAP_GSTREAMER_QUEUE_LENGTH] /// -#else - /// - /// default is 1 - /// [CV_CAP_GSTREAMER_QUEUE_LENGTH] - /// -#endif public double GStreamerQueueLength { get => Get(VideoCaptureProperties.GStreamerQueueLength); set => Set(VideoCaptureProperties.GStreamerQueueLength, value); } -#if LANG_JP /// /// ip for anable multicast master mode. 0 for disable multicast /// [CV_CAP_PROP_PVAPI_MULTICASTIP] /// -#else - /// - /// ip for anable multicast master mode. 0 for disable multicast - /// [CV_CAP_PROP_PVAPI_MULTICASTIP] - /// -#endif -// ReSharper disable InconsistentNaming + // ReSharper disable once InconsistentNaming public double PvAPIMulticastIP -// ReSharper restore InconsistentNaming { get => Get(VideoCaptureProperties.PvAPIMulticastIP); set => Set(VideoCaptureProperties.PvAPIMulticastIP, value); } + #endregion #region XI // Properties of cameras available through XIMEA SDK interface -// ReSharper disable InconsistentNaming -#if LANG_JP - /// - /// Change image resolution by binning or skipping. - /// [CV_CAP_PROP_XI_DOWNSAMPLING] - /// -#else + // ReSharper disable InconsistentNaming + /// /// Change image resolution by binning or skipping. /// [CV_CAP_PROP_XI_DOWNSAMPLING] /// -#endif public double XI_Downsampling { get => Get(VideoCaptureProperties.XI_Downsampling); set => Set(VideoCaptureProperties.XI_Downsampling, value); } -#if LANG_JP - /// - /// Output data format. - /// [CV_CAP_PROP_XI_DATA_FORMAT] - /// -#else /// /// Output data format. /// [CV_CAP_PROP_XI_DATA_FORMAT] /// -#endif - public double XI_DataFormat - { - get - { - return Get(VideoCaptureProperties.XI_DataFormat); - } - } + public double XI_DataFormat => Get(VideoCaptureProperties.XI_DataFormat); -#if LANG_JP - /// - /// Horizontal offset from the origin to the area of interest (in pixels). - /// [CV_CAP_PROP_XI_OFFSET_X] - /// -#else /// /// Horizontal offset from the origin to the area of interest (in pixels). /// [CV_CAP_PROP_XI_OFFSET_X] /// -#endif public double XI_OffsetX { get => Get(VideoCaptureProperties.XI_OffsetX); set => Set(VideoCaptureProperties.XI_OffsetX, value); } -#if LANG_JP - /// - /// Vertical offset from the origin to the area of interest (in pixels). - /// [CV_CAP_PROP_XI_OFFSET_Y] - /// -#else /// /// Vertical offset from the origin to the area of interest (in pixels). /// [CV_CAP_PROP_XI_OFFSET_Y] /// -#endif public double XI_OffsetY { get => Get(VideoCaptureProperties.XI_OffsetY); set => Set(VideoCaptureProperties.XI_OffsetY, value); } -#if LANG_JP /// /// Defines source of trigger. /// [CV_CAP_PROP_XI_TRG_SOURCE] /// -#else - /// - /// Defines source of trigger. - /// [CV_CAP_PROP_XI_TRG_SOURCE] - /// -#endif public double XI_TrgSource { get => Get(VideoCaptureProperties.XI_TrgSource); set => Set(VideoCaptureProperties.XI_TrgSource, value); } -#if LANG_JP /// /// Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. /// [CV_CAP_PROP_XI_TRG_SOFTWARE] /// -#else - /// - /// Generates an internal trigger. PRM_TRG_SOURCE must be set to TRG_SOFTWARE. - /// [CV_CAP_PROP_XI_TRG_SOFTWARE] - /// -#endif public double XI_TrgSoftware { get => Get(VideoCaptureProperties.XI_TrgSoftware); set => Set(VideoCaptureProperties.XI_TrgSoftware, value); } -#if LANG_JP - /// - /// Selects general purpose input - /// [CV_CAP_PROP_XI_GPI_SELECTOR] - /// -#else /// /// Selects general purpose input /// [CV_CAP_PROP_XI_GPI_SELECTOR] /// -#endif public double XI_GpiSelector { get => Get(VideoCaptureProperties.XI_GpiSelector); set => Set(VideoCaptureProperties.XI_GpiSelector, value); } -#if LANG_JP /// /// Set general purpose input mode /// [CV_CAP_PROP_XI_GPI_MODE] /// -#else - /// - /// Set general purpose input mode - /// [CV_CAP_PROP_XI_GPI_MODE] - /// -#endif public double XI_GpiMode { get => Get(VideoCaptureProperties.XI_GpiMode); set => Set(VideoCaptureProperties.XI_GpiMode, value); } -#if LANG_JP - /// - /// Get general purpose level - /// [CV_CAP_PROP_XI_GPI_LEVEL] - /// -#else /// /// Get general purpose level /// [CV_CAP_PROP_XI_GPI_LEVEL] /// -#endif public double XI_GpiLevel { get => Get(VideoCaptureProperties.XI_GpiLevel); set => Set(VideoCaptureProperties.XI_GpiLevel, value); } -#if LANG_JP /// /// Selects general purpose output /// [CV_CAP_PROP_XI_GPO_SELECTOR] /// -#else - /// - /// Selects general purpose output - /// [CV_CAP_PROP_XI_GPO_SELECTOR] - /// -#endif public double XI_GpoSelector { get => Get(VideoCaptureProperties.XI_GpoSelector); set => Set(VideoCaptureProperties.XI_GpoSelector, value); } -#if LANG_JP /// /// Set general purpose output mode /// [CV_CAP_PROP_XI_GPO_MODE] /// -#else - /// - /// Set general purpose output mode - /// [CV_CAP_PROP_XI_GPO_MODE] - /// -#endif public double XI_GpoMode { get => Get(VideoCaptureProperties.XI_GpoMode); set => Set(VideoCaptureProperties.XI_GpoMode, value); } -#if LANG_JP /// /// Selects camera signalling LED /// [CV_CAP_PROP_XI_LED_SELECTOR] /// -#else - /// - /// Selects camera signalling LED - /// [CV_CAP_PROP_XI_LED_SELECTOR] - /// -#endif public double XI_LedSelector { get => Get(VideoCaptureProperties.XI_LedSelector); set => Set(VideoCaptureProperties.XI_LedSelector, value); } -#if LANG_JP - /// - /// Define camera signalling LED functionality - /// [CV_CAP_PROP_XI_LED_MODE] - /// -#else /// /// Define camera signalling LED functionality /// [CV_CAP_PROP_XI_LED_MODE] /// -#endif public double XI_LedMode { get => Get(VideoCaptureProperties.XI_LedMode); set => Set(VideoCaptureProperties.XI_LedMode, value); } -#if LANG_JP - /// - /// Calculates White Balance(must be called during acquisition) - /// [CV_CAP_PROP_XI_MANUAL_WB] - /// -#else /// /// Calculates White Balance(must be called during acquisition) /// [CV_CAP_PROP_XI_MANUAL_WB] /// -#endif public double XI_ManualWB { get => Get(VideoCaptureProperties.XI_ManualWB); set => Set(VideoCaptureProperties.XI_ManualWB, value); } -#if LANG_JP - /// - /// Automatic white balance - /// [CV_CAP_PROP_XI_AUTO_WB] - /// -#else /// /// Automatic white balance /// [CV_CAP_PROP_XI_AUTO_WB] /// -#endif public double XI_AutoWB { get => Get(VideoCaptureProperties.XI_AutoWB); set => Set(VideoCaptureProperties.XI_AutoWB, value); } -#if LANG_JP /// /// Automatic exposure/gain /// [CV_CAP_PROP_XI_AEAG] /// -#else - /// - /// Automatic exposure/gain - /// [CV_CAP_PROP_XI_AEAG] - /// -#endif public double XI_AEAG { get => Get(VideoCaptureProperties.XI_AEAG); set => Set(VideoCaptureProperties.XI_AEAG, value); } -#if LANG_JP /// /// Exposure priority (0.5 - exposure 50%, gain 50%). /// [CV_CAP_PROP_XI_EXP_PRIORITY] /// -#else - /// - /// Exposure priority (0.5 - exposure 50%, gain 50%). - /// [CV_CAP_PROP_XI_EXP_PRIORITY] - /// -#endif public double XI_ExpPriority { get => Get(VideoCaptureProperties.XI_ExpPriority); set => Set(VideoCaptureProperties.XI_ExpPriority, value); } -#if LANG_JP - /// - /// Maximum limit of exposure in AEAG procedure - /// [CV_CAP_PROP_XI_AE_MAX_LIMIT] - /// -#else /// /// Maximum limit of exposure in AEAG procedure /// [CV_CAP_PROP_XI_AE_MAX_LIMIT] /// -#endif public double XI_AEMaxLimit { get => Get(VideoCaptureProperties.XI_AEMaxLimit); set => Set(VideoCaptureProperties.XI_AEMaxLimit, value); } -#if LANG_JP /// /// Maximum limit of gain in AEAG procedure /// [CV_CAP_PROP_XI_AG_MAX_LIMIT] /// -#else - /// - /// Maximum limit of gain in AEAG procedure - /// [CV_CAP_PROP_XI_AG_MAX_LIMIT] - /// -#endif public double XI_AGMaxLimit { get => Get(VideoCaptureProperties.XI_AGMaxLimit); set => Set(VideoCaptureProperties.XI_AGMaxLimit, value); } -#if LANG_JP - /// - /// default is 1 - /// [CV_CAP_PROP_XI_AEAG_LEVEL] - /// -#else /// /// default is 1 /// [CV_CAP_PROP_XI_AEAG_LEVEL] /// -#endif public double XI_AEAGLevel { get => Get(VideoCaptureProperties.XI_AEAGLevel); set => Set(VideoCaptureProperties.XI_AEAGLevel, value); } -#if LANG_JP - /// - /// default is 1 - /// [CV_CAP_PROP_XI_TIMEOUT] - /// -#else /// /// default is 1 /// [CV_CAP_PROP_XI_TIMEOUT] /// -#endif public double XI_Timeout { get => Get(VideoCaptureProperties.XI_Timeout); set => Set(VideoCaptureProperties.XI_Timeout, value); } -// ReSharper restore InconsistentNaming + // ReSharper restore InconsistentNaming #endregion #endregion diff --git a/src/OpenCvSharp/Modules/videoio/VideoWriter.cs b/src/OpenCvSharp/Modules/videoio/VideoWriter.cs index 784dd21ee..b39838b3b 100644 --- a/src/OpenCvSharp/Modules/videoio/VideoWriter.cs +++ b/src/OpenCvSharp/Modules/videoio/VideoWriter.cs @@ -3,15 +3,9 @@ namespace OpenCvSharp { -#if LANG_JP - /// - /// AVIビデオ出力機 - /// -#else /// /// AVI Video File Writer /// -#endif public class VideoWriter : DisposableCvObject { #region Init and Disposal @@ -31,20 +25,6 @@ public VideoWriter() throw new OpenCvSharpException("Failed to create VideoWriter"); } -#if LANG_JP - /// - /// ビデオライタを作成し、返す. - /// - /// 出力するビデオファイルの名前 - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else /// /// Creates video writer structure. /// @@ -55,7 +35,6 @@ public VideoWriter() /// Size of video frames. /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). /// -#endif public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, bool isColor = true) { FileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); @@ -68,22 +47,6 @@ public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, b throw new OpenCvSharpException("Failed to create VideoWriter"); } -#if LANG_JP - /// - /// ビデオライタを作成し、返す. - /// - /// 出力するビデオファイルの名前 - /// allows to specify API backends to use. Can be used to enforce a specific reader implementation - /// if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER. - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else /// /// Creates video writer structure. /// @@ -96,7 +59,6 @@ public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, b /// Size of video frames. /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). /// -#endif public VideoWriter(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, bool isColor = true) { FileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); @@ -131,68 +93,31 @@ protected override void DisposeUnmanaged() #endregion #region Properties -#if LANG_JP - /// - /// 出力するビデオファイルの名前を取得する - /// -#else + /// /// Get output video file name /// -#endif public string? FileName { get; private set; } -#if LANG_JP - /// - /// 作成されたビデオストリームのフレームレートを取得する - /// -#else /// /// Frames per second of the output video /// -#endif public double Fps { get; private set; } -#if LANG_JP - /// - /// ビデオフレームのサイズを取得する - /// -#else /// /// Get size of frame image /// -#endif public Size FrameSize { get; private set; } -#if LANG_JP - /// - /// カラーフレームかどうかの値を取得する - /// -#else /// /// Get whether output frames is color or not /// -#endif public bool IsColor { get; private set; } #endregion #region Methods -#if LANG_JP - /// - /// ビデオライタを開く - /// - /// 出力するビデオファイルの名前 - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else /// /// Creates video writer structure. /// @@ -203,7 +128,6 @@ protected override void DisposeUnmanaged() /// Size of video frames. /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). /// -#endif public bool Open(string fileName, FourCC fourcc, double fps, Size frameSize, bool isColor = true) { ThrowIfDisposed(); @@ -222,22 +146,6 @@ public bool Open(string fileName, FourCC fourcc, double fps, Size frameSize, boo return ret != 0; } -#if LANG_JP - /// - /// ビデオライタを開く - /// - /// 出力するビデオファイルの名前 - /// allows to specify API backends to use. Can be used to enforce a specific reader implementation - /// if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER. - /// - /// フレームを圧縮するためのコーデックを表す 4 文字.例えば,"PIM1" は,MPEG-1 コーデック, "MJPG" は,motion-jpeg コーデックである. - /// Win32 環境下では,null を渡すとダイアログから圧縮方法と圧縮のパラメータを選択できるようになる. - /// - /// 作成されたビデオストリームのフレームレート - /// ビデオフレームのサイズ - /// trueの場合,エンコーダはカラーフレームとしてエンコードする. falseの場合,グレースケールフレームとして動作する(現在のところ,このフラグは Windows でのみ利用できる). - /// CvVideoWriter -#else /// /// Creates video writer structure. /// @@ -250,7 +158,6 @@ public bool Open(string fileName, FourCC fourcc, double fps, Size frameSize, boo /// Size of video frames. /// If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only). /// -#endif public bool Open(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, bool isColor = true) { ThrowIfDisposed(); @@ -294,19 +201,11 @@ public void Release() GC.KeepAlive(this); } -#if LANG_JP - /// - /// 一つのフレームをビデオファイルに書き込む/追加する - /// - /// 書き込まれるフレーム - /// -#else /// /// Writes/appends one frame to video file. /// /// the written frame. /// -#endif public void Write(InputArray image) { ThrowIfDisposed(); diff --git a/src/OpenCvSharp/Modules/xfeatures2d/FREAK.cs b/src/OpenCvSharp/Modules/xfeatures2d/FREAK.cs index 9597787b7..64dcb5348 100644 --- a/src/OpenCvSharp/Modules/xfeatures2d/FREAK.cs +++ b/src/OpenCvSharp/Modules/xfeatures2d/FREAK.cs @@ -7,15 +7,9 @@ namespace OpenCvSharp.XFeatures2D { -#if LANG_JP - /// - /// FREAK 実装 - /// -#else /// /// FREAK implementation /// -#endif public class FREAK : Feature2D { private Ptr? ptrObj; diff --git a/src/OpenCvSharp/Modules/xfeatures2d/SURF.cs b/src/OpenCvSharp/Modules/xfeatures2d/SURF.cs index 0a520052f..a28347cc4 100644 --- a/src/OpenCvSharp/Modules/xfeatures2d/SURF.cs +++ b/src/OpenCvSharp/Modules/xfeatures2d/SURF.cs @@ -4,15 +4,9 @@ namespace OpenCvSharp.XFeatures2D { -#if LANG_JP - /// - /// SURF(Speeded Up Robust Features) を抽出するためのクラス. - /// -#else /// /// Class for extracting Speeded Up Robust Features from an image. /// -#endif public class SURF : Feature2D { private Ptr? detectorPtr; @@ -28,16 +22,6 @@ protected SURF(IntPtr p) ptr = detectorPtr.Get(); } -#if LANG_JP - /// - /// SURF初期化 - /// - /// keypoint.hessian の値がこの閾値よりも大きい特徴だけが検出される - /// - /// - /// false:基本的なディスクリプタ(64要素), true:拡張されたディスクリプタ(128要素) - /// -#else /// /// The SURF constructor. /// @@ -48,7 +32,6 @@ protected SURF(IntPtr p) /// false means basic descriptors (64 elements each), true means extended descriptors (128 elements each) /// false means that detector computes orientation of each feature. /// true means that the orientation is not computed (which is much, much faster). -#endif public static SURF Create(double hessianThreshold, int nOctaves = 4, int nOctaveLayers = 2, bool extended = true, bool upright = false) diff --git a/src/OpenCvSharp/Modules/xfeatures2d/StarDetector.cs b/src/OpenCvSharp/Modules/xfeatures2d/StarDetector.cs index 0ee70a824..957e72d57 100644 --- a/src/OpenCvSharp/Modules/xfeatures2d/StarDetector.cs +++ b/src/OpenCvSharp/Modules/xfeatures2d/StarDetector.cs @@ -3,15 +3,9 @@ namespace OpenCvSharp.XFeatures2D { -#if LANG_JP - /// - /// Star Detector - /// -#else /// /// The "Star" Detector /// -#endif public class StarDetector : Feature2D { private Ptr? ptrObj; diff --git a/test/OpenCvSharp.Tests/TestBase.cs b/test/OpenCvSharp.Tests/TestBase.cs index 74b30e0f7..b3e5c83a9 100644 --- a/test/OpenCvSharp.Tests/TestBase.cs +++ b/test/OpenCvSharp.Tests/TestBase.cs @@ -58,7 +58,7 @@ protected static void ImageEquals(Mat img1, Mat img2) using (var comparison = new Mat()) { - Cv2.Compare(img1, img2, comparison, CmpTypes.NE); + Cv2.Compare(img1, img2, comparison, CmpType.NE); if (img1.Channels() == 1) { Assert.Equal(0, Cv2.CountNonZero(comparison)); diff --git a/test/OpenCvSharp.Tests/calib3d/Calib3dTest.cs b/test/OpenCvSharp.Tests/calib3d/Calib3dTest.cs index 3a943a16b..54718bb27 100644 --- a/test/OpenCvSharp.Tests/calib3d/Calib3dTest.cs +++ b/test/OpenCvSharp.Tests/calib3d/Calib3dTest.cs @@ -368,7 +368,7 @@ public void FindFundamentalMat() new Point2d(1550.9714, 1744), }; - using Mat f = Cv2.FindFundamentalMat(imgPt1, imgPt2, FundamentalMatMethod.Point8); + using Mat f = Cv2.FindFundamentalMat(imgPt1, imgPt2, FundamentalMatMethods.Point8); Assert.True(f.Empty()); // TODO } diff --git a/test/OpenCvSharp.Tests/core/CoreTest.cs b/test/OpenCvSharp.Tests/core/CoreTest.cs index e394cf8da..12c3f5a2f 100644 --- a/test/OpenCvSharp.Tests/core/CoreTest.cs +++ b/test/OpenCvSharp.Tests/core/CoreTest.cs @@ -289,7 +289,7 @@ public void Compare() using var src = new Mat(bytes.Length, 1, MatType.CV_8UC1, bytes); using var dst = new Mat(); - Cv2.Compare(src, 3, dst, CmpTypes.LE); + Cv2.Compare(src, 3, dst, CmpType.LE); Assert.Equal(255, dst.Get(0)); Assert.Equal(255, dst.Get(1)); Assert.Equal(255, dst.Get(2)); diff --git a/test/OpenCvSharp.Tests/core/FileStorageTest.cs b/test/OpenCvSharp.Tests/core/FileStorageTest.cs index c74ad7905..ef60c56dd 100644 --- a/test/OpenCvSharp.Tests/core/FileStorageTest.cs +++ b/test/OpenCvSharp.Tests/core/FileStorageTest.cs @@ -35,7 +35,7 @@ public void ReadAndWrite() }; // write - using (var fs = new FileStorage(fileName, FileStorage.Mode.Write)) + using (var fs = new FileStorage(fileName, FileStorage.Modes.Write)) { fs.Add("sequence").Add("["); foreach (var s in sequence) @@ -75,7 +75,7 @@ public void ReadAndWrite() Assert.True(File.Exists(fileName)); // read - using (var fs = new FileStorage(fileName, FileStorage.Mode.Read)) + using (var fs = new FileStorage(fileName, FileStorage.Modes.Read)) { Assert.True(fs.IsOpened()); @@ -197,7 +197,7 @@ public void ReadAndWriteInMemory() // write string yaml; - using (var fs = new FileStorage("yml", FileStorage.Mode.Write | FileStorage.Mode.Memory)) + using (var fs = new FileStorage("yml", FileStorage.Modes.Write | FileStorage.Modes.Memory)) { fs.Add("sequence").Add("["); foreach (var s in sequence) @@ -242,7 +242,7 @@ public void ReadAndWriteInMemory() #pragma warning disable CS8602 #pragma warning disable CS8604 // read - using (var fs = new FileStorage(yaml, FileStorage.Mode.Read | FileStorage.Mode.Memory)) + using (var fs = new FileStorage(yaml, FileStorage.Modes.Read | FileStorage.Modes.Memory)) { Assert.True(fs.IsOpened()); diff --git a/test/OpenCvSharp.Tests/features2d/BOWImgDescriptorExtractorTest.cs b/test/OpenCvSharp.Tests/features2d/BOWImgDescriptorExtractorTest.cs index 48c981481..ec370b413 100644 --- a/test/OpenCvSharp.Tests/features2d/BOWImgDescriptorExtractorTest.cs +++ b/test/OpenCvSharp.Tests/features2d/BOWImgDescriptorExtractorTest.cs @@ -83,7 +83,7 @@ public void RunTest() using var img = Image("lenna.png"); KeyPoint[] keypoints; Mat dictionary; - var tc = new TermCriteria(CriteriaType.MaxIter, 100, 0.001d); + var tc = new TermCriteria(CriteriaTypes.MaxIter, 100, 0.001d); using (var bowTrainer = new BOWKMeansTrainer(200, tc, 1, KMeansFlags.PpCenters)) { var descriptors = new Mat(); diff --git a/test/OpenCvSharp.Tests/ml/SVMTest.cs b/test/OpenCvSharp.Tests/ml/SVMTest.cs index fb8f1556c..d620e371f 100644 --- a/test/OpenCvSharp.Tests/ml/SVMTest.cs +++ b/test/OpenCvSharp.Tests/ml/SVMTest.cs @@ -27,7 +27,7 @@ public void RunTest() { model.Type = SVM.Types.CSvc; model.KernelType = SVM.KernelTypes.Linear; - model.TermCriteria = new TermCriteria(CriteriaType.MaxIter, 100, 1e-6); + model.TermCriteria = new TermCriteria(CriteriaTypes.MaxIter, 100, 1e-6); model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); float[] testFeatureData = {90, 90}; @@ -62,7 +62,7 @@ public void SaveLoadTest() { model.Type = SVM.Types.CSvc; model.KernelType = SVM.KernelTypes.Linear; - model.TermCriteria = new TermCriteria(CriteriaType.MaxIter, 100, 1e-6); + model.TermCriteria = new TermCriteria(CriteriaTypes.MaxIter, 100, 1e-6); model.Train(trainFeatures, SampleTypes.RowSample, trainLabels); model.Save(fileName); @@ -83,7 +83,7 @@ public void SaveLoadTest() GC.KeepAlive(model2); } - using (var fs = new FileStorage(fileName, FileStorage.Mode.Read)) + using (var fs = new FileStorage(fileName, FileStorage.Modes.Read)) using (var model2 = SVM.Create()) { var node = fs["opencv_ml_svm"]; diff --git a/tool/OpenCvSharp.ReleaseMaker/Packer.cs b/tool/OpenCvSharp.ReleaseMaker/Packer.cs index 13b87e19d..72bb44982 100644 --- a/tool/OpenCvSharp.ReleaseMaker/Packer.cs +++ b/tool/OpenCvSharp.ReleaseMaker/Packer.cs @@ -78,8 +78,8 @@ public static class Packer private const string DebuggerVisualizerPath = @"OpenCvSharp.DebuggerVisualizers\bin\Release\OpenCvSharp.DebuggerVisualizers.dll"; private static readonly string[] xmlFiles = { - @"OpenCvSharp\bin\{0}\net461\OpenCvSharp.xml", - @"OpenCvSharp.Extensions\bin\{0}\net461\OpenCvSharp.Extensions.xml", + @"OpenCvSharp\bin\Release\net461\OpenCvSharp.xml", + @"OpenCvSharp.Extensions\bin\Release\net461\OpenCvSharp.Extensions.xml", @"OpenCvSharp.WpfExtensions\OpenCvSharp.WpfExtensions.xml", }; @@ -100,12 +100,7 @@ public static class Packer "opencv_world451.dll", "opencv_img_hash451.dll" }; - - private static readonly string[] languages = { - "Release", - "Release-JP" - }; - + private static readonly HashSet ignoredExt = new[]{ ".bak", ".user", @@ -162,21 +157,18 @@ private static void MakeBinaryPackage(string dir, string dirDst, string opencvVe } // XMLドキュメントコメントを選択 - foreach (var lang in languages) + foreach (var f in xmlFiles) { - foreach (var f in xmlFiles) - { - var xmlPath = Path.Combine(dirSrc, string.Format(f, lang)); - if (!File.Exists(xmlPath)) - continue; - var lg = lang.Contains("JP") ? "Japanese" : "English"; - zipArchive.CreateEntryFromFile( - xmlPath, - Path.Combine("XmlDoc-" + lg, Path.GetFileName(xmlPath)), - CompressionLevel.Optimal); - } + var xmlPath = Path.Combine(dirSrc, f); + if (!File.Exists(xmlPath)) + continue; + zipArchive.CreateEntryFromFile( + xmlPath, + Path.Combine("XmlDoc", Path.GetFileName(xmlPath)), + CompressionLevel.Optimal); } + // OpenCvSharpExtern.dllを、Windows用とUWP用それぞれで、x86/x64それぞれを入れる foreach (var p in architectures) { From 937ea382a6ac790ce554b8278c43460f3895b332 Mon Sep 17 00:00:00 2001 From: shimat Date: Mon, 8 Feb 2021 10:34:40 +0900 Subject: [PATCH 3/3] s/nuget_// --- .github/workflows/publish_nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_nuget.yml b/.github/workflows/publish_nuget.yml index 025c54b58..02493185d 100644 --- a/.github/workflows/publish_nuget.yml +++ b/.github/workflows/publish_nuget.yml @@ -15,7 +15,7 @@ jobs: with: github_token: ${{secrets.GITHUB_TOKEN}} workflow: windows.yml - name: nuget_packages_windows + name: packages_windows - name: Download ubuntu artifact uses: dawidd6/action-download-artifact@v2