| | |
| | | using Orientation = RichCreator.Utility.Structs.Orientation; |
| | | using ZTImage.Collections; |
| | | |
| | | |
| | | namespace RichCreator.Editor |
| | | { |
| | | /// <summary> |
| | |
| | | string imagePath = string.Empty; |
| | | Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog(); |
| | | ofd.DefaultExt = ".jpg"; |
| | | ofd.Filter = "jpg file|*.jpg"; |
| | | ofd.Filter = "jpg file|*.jpg;*.png"; |
| | | ofd.Multiselect = false; |
| | | if (ofd.ShowDialog() == true) |
| | | { |
| | |
| | | /// <param name="e"></param> |
| | | private void FindLocationPoint_Click(object sender, RoutedEventArgs e) |
| | | { |
| | | Image<Hsv, byte> hsvImage = new Image<Hsv, byte>(this.targetImage.Width, this.targetImage.Height); |
| | | CvInvoke.CvtColor(this.targetImage, hsvImage, Emgu.CV.CvEnum.ColorConversion.Rgb2Hsv); |
| | | |
| | | MultiList<ZTRectangle, Int32> list = new MultiList<ZTRectangle, int>(); |
| | | ZTRectangle limit = new ZTRectangle(0, 0, this.targetImage.Width, this.targetImage.Height); |
| | | if (DnfCVHelper.GetLocationPoint(out list,hsvImage,limit)) |
| | | ParametersPoint location = DnfCVHelper.GetLocationPoint(this.targetImage, limit); |
| | | if (!location.Equals(ParametersPoint.Empty)) |
| | | { |
| | | //找到位置显示出来 |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | ZTRectangle rect = list[i].Item1; |
| | | Int32 number = list[i].Item2; |
| | | DrawRectangle(rect.Start.X, rect.Start.Y, rect.End.X - rect.Start.X, rect.End.Y - rect.Start.Y, Colors.Green,number); |
| | | } |
| | | |
| | | DrawRectangle(location.Point.X, location.Point.Y, 12, 10, Colors.Green, location.Parameter); |
| | | } |
| | | else |
| | | { |
| | | MessageBox.Show("未找到定位点"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | window.ShowDialog(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |