| | |
| | | Image<Hsv, byte> hsv = new Image<Hsv, byte>(this.targetImage.Width, this.targetImage.Height); |
| | | CvInvoke.CvtColor(this.targetImage, hsv, ColorConversion.Rgb2Hsv); |
| | | |
| | | Direction d; |
| | | |
| | | //List<ZTRectangle> rects = CVHelper.FindBlocks(hsv, new Hsv(165, 247, 175), new Hsv(173, 255, 230), new ZTSize(30, 30)); |
| | | |
| | | Hsv minHsv = new Hsv(0, 0, 178); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | private void FindThing_Click(object sender, RoutedEventArgs e) |
| | | { |
| | | //转为hsv |
| | | Image<Hsv, byte> hsv = new Image<Hsv, byte>(this.targetImage.Width, this.targetImage.Height); |
| | | CvInvoke.CvtColor(this.targetImage, hsv, ColorConversion.Rgb2Hsv); |
| | | |
| | | ZTPoint[] things=DnfCVHelper.FindThings(hsv, new ZTRectangle(0, 0, this.targetImage.Width, this.targetImage.Height)); |
| | | |
| | | |
| | | int x, y, width, height; |
| | | for (int i = 0; i < things.Length; i++) |
| | | { |
| | | x = things[i].X; |
| | | y = things[i].Y; |
| | | width = 25; |
| | | height = 25; |
| | | DrawRectangle(x, y, width, height, Colors.Green); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | ZTPoint line = points[i]; |
| | | DrawRectangle(line.X, line.Y, 5, 5, Colors.Yellow); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 测试找关闭按钮 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void FindCloseButton_Click(object sender, RoutedEventArgs e) |
| | | { |
| | | |
| | | |
| | | ZTRectangle closeButtonRect = ZTRectangle.Empty; |
| | | if (!DnfCVHelper.GetAlertWindow(out closeButtonRect, this.targetImage, new ZTRectangle (0,0, targetImage.Width, targetImage.Height))) |
| | | { |
| | | MessageBox.Show("未找到关闭按钮"); |
| | | return; |
| | | } |
| | | DrawRectangle(closeButtonRect.Start.X, closeButtonRect.Start.Y, closeButtonRect.End.X-closeButtonRect.Start.X, closeButtonRect.End.Y-closeButtonRect.Start.Y, Colors.Yellow); |
| | | } |
| | | |
| | | |
| | |
| | | window.ShowDialog(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |