diff options
author | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-09-23 04:54:15 +0300 |
---|---|---|
committer | Tiago Conceição <Tiago_caza@hotmail.com> | 2021-09-23 04:54:15 +0300 |
commit | 321fabcdf891a19c1d1a4cec6532f9b7bd8422cb (patch) | |
tree | 8f15ecc881336efe402729b9378eee5da3486842 /UVtools.Core/Extensions/EmguExtensions.cs | |
parent | b8a705ce214c98b05b4f4ec490019e91f4ec3454 (diff) |
v2.23.1v2.23.1
- **Issues:**
- (Add) Suction cups: Additional setting to specify the required minimum height to be flagged as a issue (#302)
- (Change) Allow touching bounds to have a bounding rectangle and zoom into the issue
- (Change) Disable the ability to copy issues row text from list as this is crashing the program
- (Change) Decrease cache count of the layers from x10 to x5 to free RAM
- (Fix) Touching bounds are reporting areas of 0
- (Fix) Draw crosshair for issues are called multiple times
- (Fix) Detection error when resin traps are enabled on some cases (#303)
- (Fix) Resin trap false-positives (#305)
- (Fix) When removing multiple islands at once only the first is cleared from the issue list
- **UI:**
- (Change) Tool - Resize icon
- (Change) Move "Crosshairs" button inside "Issues" button
- (Add) Tool - Morph - Offset crop: Like erode but discards the outer pixels
- (Fix) Corrected bottom lift unit label in light-off delay calculator (#304)
Diffstat (limited to 'UVtools.Core/Extensions/EmguExtensions.cs')
-rw-r--r-- | UVtools.Core/Extensions/EmguExtensions.cs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/UVtools.Core/Extensions/EmguExtensions.cs b/UVtools.Core/Extensions/EmguExtensions.cs index 90473c4..1e85659 100644 --- a/UVtools.Core/Extensions/EmguExtensions.cs +++ b/UVtools.Core/Extensions/EmguExtensions.cs @@ -515,15 +515,9 @@ namespace UVtools.Core.Extensions /// <param name="mat"></param> /// <param name="threshold">Pixel brightness threshold</param> /// <returns></returns> - public static unsafe bool IsZeroed(this Mat mat, byte threshold = 0) + public static bool IsZeroed(this Mat mat, byte threshold = 0) { - var ptr = mat.GetBytePointer(); - var length = mat.GetLength(); - for (var i = 0; i < length; i++) - { - if (ptr[i] > threshold) return false; - } - return true; + return mat.FindFirstPixelGreaterThan(threshold) == -1; } #endregion @@ -546,7 +540,7 @@ namespace UVtools.Core.Extensions /// <returns>Pixel position in the span, or -1 if not found</returns> public static int FindFirstPositivePixel(this Mat mat) { - return mat.FindFirstPixelEqualOrGreaterThan(1); + return mat.FindFirstPixelGreaterThan(0); } /// <summary> @@ -1117,7 +1111,7 @@ namespace UVtools.Core.Extensions // if there are no more 'white' pixels in the image, then // break from the loop - if (image.FindFirstPixelEqualOrGreaterThan(1) == -1) break; + if (image.IsZeroed()) break; } return skeleton; |