示例#1
0
 /// <summary>
 /// 图片均衡操作,将传入图片自动转换,imgWidth:设定图片宽度,imgHeight图片设定高度
 /// 图片(forexample:a.bmp)另存为同文件夹下面的_a.bmp
 /// </summary>
 /// <param name="ImagePath"></param>
 public void QualizerImage(string ImagePath, int imgWidth, int imgHeight)
 {
     try
     {
         if ((ImagePath.Length == 0) || (!File.Exists(ImagePath)))
         {
             return;
         }
         EImageBW8 EBW8ImageOrig = new EImageBW8(); // EImageBW8 instance
         EImageBW8 EBW8ImageDest = new EImageBW8(); // EImageBW8 instance
         EBW8ImageOrig.SetSize(imgWidth, imgHeight);
         // Make image black
         EasyImage.Oper(EArithmeticLogicOperation.Copy, new EBW8(0), EBW8ImageOrig);
         EBW8ImageOrig.Load(ImagePath);
         EBW8ImageDest.SetSize(imgWidth, imgHeight);
         // Make image black
         EasyImage.Oper(EArithmeticLogicOperation.Copy, new EBW8(0), EBW8ImageDest);
         EBW8ImageDest.SetSize(EBW8ImageOrig);
         EasyImage.Equalize(EBW8ImageOrig, EBW8ImageDest);
         EBW8ImageOrig.Dispose();
         //EBW8ImageDest.Save(ImagePath);
         EBW8ImageDest.Save(ImageSaveAsPath(ImagePath));
     }
     catch
     {
         throw;
     }
 }
        private void excelToolStripMenuItem1_Click_1(object sender, EventArgs e)
        {
            saveFileDialog1.Filter   = "JPEG|*.jpg";
            saveFileDialog1.FileName = System.IO.Path.GetFileNameWithoutExtension(files[FileListBox.SelectedIndex]);
            saveFileDialog1.Title    = "Save the Picture";

            if (saveFileDialog1.ShowDialog() == DialogResult.OK && saveFileDialog1.FileName != "")
            {
                GrayImg1.Save(saveFileDialog1.FileName, EImageFileType.Jpeg);
            }
        }
示例#3
0
 public void SavePatterns(
     string pattern1_FilePath,
     string pattern2_FilePath,
     string pattern1_ImageFilePath,
     string pattern2_ImageFilePath)
 {
     if (!isPatternReady)
     {
         throw new Exception("Pattern Not Ready");
     }
     EMatcher1_.Save(pattern1_FilePath);
     EMatcher2_.Save(pattern2_FilePath);
     Pattern1.Save(pattern1_ImageFilePath);
     Pattern2.Save(pattern2_ImageFilePath);
 }