Exemplo n.º 1
0
 //--------------------------------------------------------------------------------------
 private void tsbCleanAccurateDefault_Click(object sender, EventArgs e)
 {
     try
     {
         Bitmap lInBmp = pbBlackWhite.Image as Bitmap;
         if (lInBmp == null)
         {
             MessageBox.Show("Нет картинки");
             return;
         }
         byte[][] lMatrix = CBlackWhiteExplorer.BitmapToBinaryMatrix(lInBmp);
         if (cbClearColor.SelectedIndex < 3)
         {
             CBlackWhiteExplorer.RemoveIsolatePointAccurate(lMatrix, (byte)cbClearColor.SelectedIndex);
         }
         else if (cbClearColor.SelectedIndex == 3)
         {
             CBlackWhiteExplorer.RemoveIsolatePointAccurate(lMatrix, 0);
             CBlackWhiteExplorer.RemoveIsolatePointAccurate(lMatrix, 1);
         }
         else
         {
             CBlackWhiteExplorer.RemoveIsolatePointAccurate(lMatrix, 1);
             CBlackWhiteExplorer.RemoveIsolatePointAccurate(lMatrix, 0);
         }
         Bitmap lNewBmp = CBlackWhiteExplorer.BinaryMatrixToBitmap(lMatrix);
         pbAfterCleanExactDefault.Image = lNewBmp;
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.ToString());
     }
 }