From 730fe7ea65bcadbe235e40bb54b2410d14495267 Mon Sep 17 00:00:00 2001
From: asmrobot <asmrobot@hotmail.com>
Date: Mon, 14 Oct 2019 04:33:21 +0000
Subject: [PATCH] add change channel

---
 src/RichCreator.Editor/MainWindow.xaml.cs |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/src/RichCreator.Editor/MainWindow.xaml.cs b/src/RichCreator.Editor/MainWindow.xaml.cs
index f613c18..e5ec7cd 100644
--- a/src/RichCreator.Editor/MainWindow.xaml.cs
+++ b/src/RichCreator.Editor/MainWindow.xaml.cs
@@ -353,7 +353,7 @@
             }
         }
 
-
+        //Hsv查找选区
         private void FindSelectionForHsv(object sender, RoutedEventArgs e)
         {
             Int32 thresholdValue = (Int32)this.ThresholdSlider.Value;
@@ -373,6 +373,29 @@
             }
         }
 
+        /// <summary>
+        /// Thresold查找选取
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void FindSelectionForThresold(object sender, RoutedEventArgs e)
+        {
+            Int32 thresholdValue = (Int32)this.ThresholdSlider.Value;
+            string colorString = SerialToString();
+            ColorArray colorArray = ColorArray.FromThresholdString(thresholdValue, colorString);
+
+            ZTRectangle rect = ZTRectangle.Empty;
+            ZTRectangle limit = new ZTRectangle(0, 0, this.targetImage.Width - 1, this.targetImage.Height - 1);
+            bool result = CVHelper.FindColorArrayForThreshold(out rect, this.sourceImage, colorArray, limit);
+            if (result)
+            {
+                DrawRectangle(rect.Start.X, rect.Start.Y, rect.End.X - rect.Start.X + 1, rect.End.Y - rect.Start.Y + 1, Colors.Green);
+            }
+            else
+            {
+                MessageBox.Show("未找到");
+            }
+        }
 
         /// <summary>
         /// 查找所有方块

--
Gitblit v1.9.3