如果要对医疗报告执行OCR,如何使用Iron-Ocr获得更好的结果

时间:2019-07-16 02:33:02

标签: c# image-processing ocr opencvsharp

enter image description here

我想对医学报告进行OCR,如何获得更好的结果。
请指导,因为我是编程新手。

我首先将图像转换为灰度,然后进行了二值化 但没有任何帮助提高准确性。感谢任何帮助

class Program
{
    static void Main(string[] args)
    {
        using (Bitmap bitmap = (Bitmap)Image.FromFile(@"C:\Users\gourabkonar\Source\Repos\OCRTreseractReport\OCRTreseractReport\img1.png"))
        {
            using (Bitmap newBitmap = new Bitmap(bitmap))
            {
                newBitmap.SetResolution(300, 300);
                newBitmap.Save("file300.png");
            }
        }
        Bitmap img = new Bitmap("file300.png");
        var Ocr = new AdvancedOcr()
        {
            CleanBackgroundNoise = true,
            EnhanceContrast = true,
            EnhanceResolution = true,
            Language = IronOcr.Languages.English.OcrLanguagePack,
            Strategy = IronOcr.AdvancedOcr.OcrStrategy.Advanced,
            ColorSpace = AdvancedOcr.OcrColorSpace.Color,
            DetectWhiteTextOnDarkBackgrounds = true,
            InputImageType = AdvancedOcr.InputTypes.AutoDetect,
            RotateAndStraighten = true,
            ReadBarCodes = true,
            ColorDepth = 4
        };
        var result = Ocr.Read(@"C:\Users\gourabkonar\Desktop\New folder\img.jpg");
        Console.WriteLine(result.Text);
        Console.ReadLine();
    }
}

0 个答案:

没有答案