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 | |
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)
-rw-r--r-- | CHANGELOG.md | 20 | ||||
-rw-r--r-- | UVtools.Core/EmguCV/EmguContours.cs | 2 | ||||
-rw-r--r-- | UVtools.Core/Extensions/EmguExtensions.cs | 14 | ||||
-rw-r--r-- | UVtools.Core/Managers/IssueManager.cs | 2 | ||||
-rw-r--r-- | UVtools.Core/Operations/OperationMorph.cs | 22 | ||||
-rw-r--r-- | UVtools.WPF/MainWindow.axaml | 27 | ||||
-rw-r--r-- | UVtools.WPF/MainWindow.axaml.cs | 2 |
7 files changed, 63 insertions, 26 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c031c11..3650bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,26 @@ # Changelog +## 23/09/2021 - v2.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) + ## 21/09/2021 - v2.23.0 -- Issues: +- **Issues:** - **Suction cups:** - Add a auto repair feature for this issues by drill a vertical vent hole (#296) - Add a manual repair feature for this issues by drill a vertical vent hole when click on remove (#301) diff --git a/UVtools.Core/EmguCV/EmguContours.cs b/UVtools.Core/EmguCV/EmguContours.cs index 62bfd47..50e37a4 100644 --- a/UVtools.Core/EmguCV/EmguContours.cs +++ b/UVtools.Core/EmguCV/EmguContours.cs @@ -241,7 +241,7 @@ namespace UVtools.Core.EmguCV CvInvoke.BitwiseAnd(contour1Mat, contour2Mat, contour1Mat); - return contour1Mat.FindFirstPositivePixel() != -1; + return !contour1Mat.IsZeroed(); } } } 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; diff --git a/UVtools.Core/Managers/IssueManager.cs b/UVtools.Core/Managers/IssueManager.cs index 6eb6874..a8109ee 100644 --- a/UVtools.Core/Managers/IssueManager.cs +++ b/UVtools.Core/Managers/IssueManager.cs @@ -1115,7 +1115,7 @@ namespace UVtools.Core.Managers CvInvoke.Circle(circleCheck, new(centroid.X + inverseOffset.X, centroid.Y + inverseOffset.Y), diameter, EmguExtensions.WhiteColor, -1); CvInvoke.BitwiseAnd(circleCheck, contourMat, circleCheck); - return circleCheck.FindFirstPositivePixel() != -1 + return !circleCheck.IsZeroed() ? centroid /* 5px centroid is inside layer! drill baby drill */ : new Point(-1,-1); /* centroid is not inside the actual contour, no drill */ } diff --git a/UVtools.Core/Operations/OperationMorph.cs b/UVtools.Core/Operations/OperationMorph.cs index 27fc4ef..ce73490 100644 --- a/UVtools.Core/Operations/OperationMorph.cs +++ b/UVtools.Core/Operations/OperationMorph.cs @@ -31,14 +31,17 @@ namespace UVtools.Core.Operations [Description("Dilate: Expands the boundaries within the object")] Dilate = MorphOp.Dilate, - [Description("Gap Closing - Closes small holes inside the objects")] + [Description("Gap closing: Closes small holes inside the objects")] Close = MorphOp.Close, - [Description("Noise Removal - Removes small isolated pixels")] + [Description("Noise removal: Removes small isolated pixels")] Open = MorphOp.Open, - [Description("Gradient - Removes the interior areas of objects")] + [Description("Gradient: Removes the interior areas of objects")] Gradient = MorphOp.Gradient, + + [Description("Offset crop: Like erode but discards the outer pixels")] + OffsetCrop, } #endregion @@ -66,6 +69,9 @@ namespace UVtools.Core.Operations #endregion #region Properties + + public MorphOp MorphOperationOpenCV => _morphOperation == MorphOperations.OffsetCrop ? MorphOp.Erode : (MorphOp)_morphOperation; + public MorphOperations MorphOperation { get => _morphOperation; @@ -186,13 +192,19 @@ namespace UVtools.Core.Operations if (CoreSettings.CanUseCuda) { var gpuMat = target.ToGpuMat(); - using var morph = new CudaMorphologyFilter((MorphOp)MorphOperation, target.Depth, target.NumberOfChannels, Kernel.Matrix, Kernel.Anchor, iterations); + using var morph = new CudaMorphologyFilter(MorphOperationOpenCV, target.Depth, target.NumberOfChannels, Kernel.Matrix, Kernel.Anchor, iterations); morph.Apply(gpuMat, gpuMat); gpuMat.Download(target); } else { - CvInvoke.MorphologyEx(target, target, (MorphOp) MorphOperation, Kernel.Matrix, Kernel.Anchor, iterations, BorderType.Reflect101, default); + CvInvoke.MorphologyEx(target, target, MorphOperationOpenCV, Kernel.Matrix, Kernel.Anchor, iterations, BorderType.Reflect101, default); + + if (_morphOperation == MorphOperations.OffsetCrop) + { + var originalRoi = GetRoiOrDefault(original); + originalRoi.CopyTo(target, target); + } } ApplyMask(original, target); diff --git a/UVtools.WPF/MainWindow.axaml b/UVtools.WPF/MainWindow.axaml index fc3559e..e825817 100644 --- a/UVtools.WPF/MainWindow.axaml +++ b/UVtools.WPF/MainWindow.axaml @@ -1868,25 +1868,38 @@ IsChecked="{Binding ShowLayerImageIssues}" ToolTip.Tip="Highlight Issues on current layer. Valid only if Issues are calculated." VerticalAlignment="Stretch" - Margin="1,0,0,0" - > - <StackPanel Orientation="Horizontal"> + Margin="1,0,0,0"> + <Button.ContextMenu> + <ContextMenu PlacementMode="Bottom"> + <CheckBox + ToolTip.Tip="Show crosshairs for selected issues on the current layer" + IsChecked="{Binding ShowLayerImageCrosshairs}"> + <StackPanel Orientation="Horizontal"> + <Image Source="/Assets/Icons/crosshairs-16x16.png"/> + <TextBlock Margin="5,0,5,0" Text="Crosshairs"/> + </StackPanel> + </CheckBox> + + </ContextMenu> + </Button.ContextMenu> + <StackPanel Orientation="Horizontal"> <Image Source="/Assets/Icons/warning-16x16.png"/> - <TextBlock Margin="5,0,5,0" Text="Issues"/> + <TextBlock Margin="5,0,5,0" Text="Issues ⮟"/> </StackPanel> </ToggleButton> + <!-- <ToggleButton IsChecked="{Binding ShowLayerImageCrosshairs}" - ToolTip.Tip="Show crosshairs for selected issues on the current layer." + ToolTip.Tip="Show crosshairs for selected issues on the current layer" VerticalAlignment="Stretch" - Margin="1,0,0,0" - > + Margin="1,0,0,0"> <StackPanel Orientation="Horizontal"> <Image Source="/Assets/Icons/crosshairs-16x16.png"/> <TextBlock Margin="5,0,5,0" Text="Crosshairs"/> </StackPanel> </ToggleButton> + !--> <Button Name="LayerPreviewOutlineButton" ToolTip.Tip="Click to access the various outlines." diff --git a/UVtools.WPF/MainWindow.axaml.cs b/UVtools.WPF/MainWindow.axaml.cs index 7b2e5f1..1271a47 100644 --- a/UVtools.WPF/MainWindow.axaml.cs +++ b/UVtools.WPF/MainWindow.axaml.cs @@ -88,7 +88,7 @@ namespace UVtools.WPF Tag = new OperationResize(), Icon = new Avalonia.Controls.Image { - Source = new Bitmap(App.GetAsset("/Assets/Icons/crop-16x16.png")) + Source = new Bitmap(App.GetAsset("/Assets/Icons/expand-alt-16x16.png")) } }, new() |