Beispiel #1
0
 // 打印
 private void printToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (pcxImage == null)
     {
         pictureBox.Image = null;
     }
     else
     {
         pictureBox.Image = PCXHelper.ScalePCX(pcxImage.OldFilename);
     }
 }
Beispiel #2
0
 // 关于"查看签名"菜单的单击事件
 private void signToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Image imageToSet = null;
     if (pcxImage == null)
     {
         pictureBox.Image = null;
     }
     else
     {
         imageToSet = PCXHelper.ReviewPCX(pcxImage.OldFilename);
         pictureBox.Image = imageToSet;
     }
 }
Beispiel #3
0
        /*
         * ToolStripMenuItem控件所处理的事件
         */

        #region 文件菜单

        // 关于"打开"菜单的单击事件
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofdlg = new OpenFileDialog();
            ofdlg.InitialDirectory = @"C:\";
            //ofdlg.Filter = "Image Files (*.pcx,*.bmp, *.jpg,*png)|*.pcx;*.jpg;*.bmp;*.png";
            ofdlg.Filter = "Image Files (*.pcx)|*.pcx|All Files (*.*)|*.*";
            if (ofdlg.ShowDialog() == DialogResult.OK)
            {
                string filename = ofdlg.FileName;
                //this.pictureBox.Image = Image.FromFile(filename); //C#中不能直接操作PCX图片
                Image imageToSet = null;
                imageToSet = PCXHelper.LoadPCX(filename);
                this.pcxImage = PCXHelper.GetPCXImage(filename);
                pictureBox.Image = imageToSet;
            }
        }
Beispiel #4
0
 // 关于"二值化数据"菜单的单击事件
 private void binaryToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (pcxImage == null)
     {
         pictureBox.Image = null;
     }
     else
     {
         //pictureBox.Image = null;
         string binary = PCXHelper.BinaryPCX(pcxImage.OldFilename);
         Graphics g = this.pictureBox.CreateGraphics();
         g.Clear(Color.White);
         SolidBrush b1 = new SolidBrush(Color.Blue);//定义单色画刷
         g.DrawString(binary, new Font("Arial", 3), b1, new PointF(0, 0));
     }
 }
Beispiel #5
0
        //构造函数-2:由文件路径创建,忽略类别
        public Features(string p_FileFullName)
        {
            if (!File.Exists(p_FileFullName))
            {
                return;
            }
            this.filepath = p_FileFullName;
            Image image = PCXHelper.LoadPCX(p_FileFullName);

            this.pcximage = PCXHelper.GetPCXImage(p_FileFullName);
            PcxtoMartix();
            ET1();
            DT12();
            MergeFeature();
            classID = -1;
        }
Beispiel #6
0
        // 选择未知样本
        private void selectSampleButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofdlg = new OpenFileDialog();

            ofdlg.InitialDirectory = @"C:\";
            ofdlg.Filter           = "Image Files (*.pcx)|*.pcx|All Files (*.*)|*.*";
            if (ofdlg.ShowDialog() == DialogResult.OK)
            {
                string filepath = ofdlg.FileName;
                this.filepathText.Text = filepath;
                Image imageToSet = null;
                imageToSet = PCXHelper.LoadPCX(filepath);
                previewPictureBox.Image     = imageToSet;
                this.classifyButton.Enabled = true;
            }
        }
        private void confirmButton_Click(object sender, EventArgs e)
        {
            if (selectedSampleListBox.Items.Count == 0)
            {
                MessageBox.Show(this, "你没有选择训练样本,请先选择", "提示信息", MessageBoxButtons.OK);
            }
            else
            {
                List <PCXImage> pcxList = new List <PCXImage>();
                int             count   = selectedSampleListBox.Items.Count;
                IList           list    = selectedSampleListBox.Items;
                List <string>   strlist = (List <string>)SelectedPCXHelper.ListConvert(list);
                foreach (string str in strlist)
                {
                    string   filename = string.Format(@"{0}", str);
                    Image    image    = PCXHelper.LoadPCX(filename);
                    PCXImage pcximage = PCXHelper.GetPCXImage(filename);
                    PCXImage pImage   = PCXHelper.GetPCXImage(pcximage);
                    pcxList.Add(pImage);
                }
                pcxList = pcxList.ToList();
                SelectedPCXHelper.SetSelPCXFromLB(pcxList, textDirPath.Text);

                List <PCXImage> unselpcxList = new List <PCXImage>();
                IList           unsellist    = unSelSampleListBox.Items;
                List <string>   unselstrlist = (List <string>)SelectedPCXHelper.ListConvert(unsellist);
                foreach (string str in unselstrlist)
                {
                    string   filename = string.Format(@"{0}", str);
                    Image    image    = PCXHelper.LoadPCX(filename);
                    PCXImage pcximage = PCXHelper.GetPCXImage(filename);
                    PCXImage pImage   = PCXHelper.GetPCXImage(pcximage);
                    unselpcxList.Add(pImage);
                }
                unselpcxList = unselpcxList.ToList();
                SelectedPCXHelper.SetUnselPCXList(unselpcxList, textDirPath.Text);
                this.Close();
            }
        }