private void AutoFeatherButton_Click(object sender, EventArgs e)
        {
            BinaryTool.Enabled = true;
            PicFromCamera.Enabled = true;
            PicFromLocality.Enabled = true;
            CutImage2.Enabled = true;
            DeleteFeather.Enabled = true;
            MainUndobutton.Enabled = true;
            CancleCut.Enabled = true;
            OpenFeather.Enabled = true;
            AddPoint.Enabled = true;

            if (int.Parse(AutoFeathertextBox1.Text) > 20)
            {
                AutoFeathertextBox1.Text = "20";
            }
            else if (int.Parse(AutoFeathertextBox1.Text) <= 0)
            {
                AutoFeathertextBox1.Text = "0";
            }
            defaultRanNum = int.Parse(AutoFeathertextBox1.Text);
            featherRegion.Clear();
            FeatherdataGrid.Rows.Clear();
            showfeature.Clear();  //清空数据

            SizeChangecount = 0;   //将图片变为原始大小
            if (bmp != null)
            {
                picturebox.Size = bmp.Size;

                if (Mainpanel.Width > bmp.Width && Mainpanel.Height > bmp.Height)
                {
                    picturebox.Location = new Point((Mainpanel.Width - bmp.Size.Width) / 2, (Mainpanel.Height - bmp.Size.Height) / 2);

                }
                else if (Mainpanel.Width > bmp.Width)
                {
                    picturebox.Location = new Point((Mainpanel.Width - bmp.Size.Width) / 2, 0);

                }
                else if (Mainpanel.Height > bmp.Height)
                {
                    picturebox.Location = new Point(0, (Mainpanel.Height - bmp.Size.Height) / 2);

                }
                else
                {
                    picturebox.Location = new Point(0, 0);
                }
            }
            switch (AutoAddFeathercomboBox.Text)
            {
                case "genetic algorithm":
                    {
                        ConfigGen configgen = new ConfigGen(savePath,programPath);

                        //configgen.Show();
                        if (configgen.ShowDialog() == DialogResult.OK)
                        {
                            try
                            {
                                string[] data = configgen.data;
                           //     string DebugPath = StringOperateHelp.LeftOfRightmostOf(savePath, '\\');
                                if (File.Exists(programPath +PublicVariable.NegativePointsFileName))
                                {
                                    FileStream fs = new FileStream(programPath + PublicVariable.NegativePointsFileName, FileMode.Open);
                                    StreamReader streamreader = new StreamReader(fs);
                                    data = streamreader.ReadLine().Split(',');
                                    for (int i = 0; i < pointNum; i++)
                                    {
                                        featherRgnstruct tmp = new featherRgnstruct();
                                        tmp.rec = new Rectangle(int.Parse(data[i * 3+1])+leftX, int.Parse(data[i * 3])+leftY, 3, 3);
                                        tmp.featherNum = int.Parse(data[i * 3+2]);
                                        featherRegion.Add(tmp);
                                        showfeature.Add(tmp);
                                        FeatherdataGrid.Rows.Add(tmp.rec.X,tmp.rec.Y,tmp.featherNum);
                                    }
                                    picturebox.Invalidate();
                                }
                            }
                            catch
                            {

                            }

                        }
                        picturebox.Invalidate();
                    }
                    break;
                case "random":
                    {
                        Random random = new Random();

                        for (int i = 0; i < defaultRanNum; i++)
                        {
                            featherRgnstruct tmp = new featherRgnstruct();
                            tmp.rec = new Rectangle(random.Next(rightX-leftX)+leftX, random.Next(rightY-leftY)+leftY, 3, 3);
                            tmp.featherNum = 1;
                            featherRegion.Add(tmp);
                            showfeature.Add(tmp);
                            FeatherdataGrid.Rows.Add(tmp.rec.X, tmp.rec.Y, 1);

                        }
                        picturebox.Invalidate();
                    }
                    break;
            }
            BasegroupBox.Controls.Clear();
            BasegroupBox.Text = null;
        }
        private void AutoFeatherButton_Click(object sender, EventArgs e)
        {
            if (int.Parse(AutoFeathertextBox1.Text) > 20)
            {
                AutoFeathertextBox1.Text = "20";
            }
            else if (int.Parse(AutoFeathertextBox1.Text) <= 0)
            {
                AutoFeathertextBox1.Text = "0";
            }
            defaultRanNum = int.Parse(AutoFeathertextBox1.Text);
            borderRegion.Clear();
            BorderdataGrid.Rows.Clear();
            showborder.Clear();
            switch (AutoAddFeathercomboBox.Text)
            {
                case "genetic algorithm":
                    {
                        ConfigGen configgen = new ConfigGen(savePath,programPath);
                        configgen.Show();

                        picturebox.Invalidate();
                    }
                    break;
                case "random":
                    {
                        Random random = new Random();
                        for (int i = 0; i < defaultRanNum; i++)
                        {

                        }
                        picturebox.Invalidate();
                    }
                    break;
            }
        }