我将所有有关图像处理的代码都综合到了 ImageProcessing类中,其中二值化是下面的处理函数:
//二值化
public void AutoBinarize(RasterImage image)
{
AutoBinarizeCommand command = new AutoBinarizeCommand();
command.Run(image);
}
下面的代码是调用imageprocessing类的二值化函数的代码
ImageProcessing imageProcessing = new ImageProcessing();
imageProcessing.AutoBinarize(imageViewer.Image);
string filename = _tempFilePath + filesDic[CurrentPageIndex + 1];//(CurrentPageIndex + 1).ToString() + ".tif";
string extension = filesDic[CurrentPageIndex + 1].Substring(filesDic[CurrentPageIndex + 1].IndexOf('.'));
_codecs.Save(imageViewer.Image, filename, FileCompressFormat(extension.ToLower(), imageViewer.Image.BitsPerPixel), imageViewer.Image.BitsPerPixel);
|