asmrobot
2019-11-13 576b92fd82f568572bc4beb125fa0ba0191a602f
src/RichCreator.Editor/MainWindow.xaml.cs
@@ -29,6 +29,7 @@
using Orientation = RichCreator.Utility.Structs.Orientation;
using ZTImage.Collections;
namespace RichCreator.Editor
{
    /// <summary>
@@ -83,7 +84,7 @@
            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)
            {
@@ -499,22 +500,17 @@
        /// <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("未找到定位点");
            }
        }
@@ -1122,6 +1118,8 @@
            window.ShowDialog();
        }