| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //Hsv查找选区 |
| | | private void FindSelectionForHsv(object sender, RoutedEventArgs e) |
| | | { |
| | | Int32 thresholdValue = (Int32)this.ThresholdSlider.Value; |
| | |
| | | } |
| | | } |
| | | |
| | | /// <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> |
| | | /// 查找所有方块 |