ByteScout PDF Suite - C# - Read Text From Noisy Image with PDF Extractor SDK - ByteScout

ByteScout PDF Suite – C# – Read Text From Noisy Image with PDF Extractor SDK

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – C# – Read Text From Noisy Image with PDF Extractor SDK

How to read text from noisy image with PDF extractor SDK in C# using ByteScout PDF Suite

Learning is essential in computer world and the tutorial below will demonstrate how to read text from noisy image with PDF extractor SDK in C#

The code displayed below will guide you to install an C# app to read text from noisy image with PDF extractor SDK. Want to read text from noisy image with PDF extractor SDK in your C# app? ByteScout PDF Suite is designed for it. ByteScout PDF Suite is the set that includes 6 SDK products to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript.

Want to quickly learn? This fast application programming interfaces of ByteScout PDF Suite for C# plus the guidelines and the code below will help you quickly learn how to read text from noisy image with PDF extractor SDK. IF you want to implement the functionality, just copy and paste this code for C# below into your code editor with your app, compile and run your application. This basic programming language sample code for C# will do the whole work for you to read text from noisy image with PDF extractor SDK.

You can download free trial version of ByteScout PDF Suite from our website to see and try many others source code samples for C#.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using Bytescout.PDFExtractor; using System; namespace ReadTextFromNoisyImage { class Program { static void Main(string[] args) { try { //Read all text from noisy image file using (TextExtractor extractor = new TextExtractor()) { // Load noisy image document extractor.LoadDocumentFromFile("sample.png"); // Set the font repairing OCR mode extractor.OCRMode = OCRMode.TextFromImagesAndVectorsAndRepairedFonts; // Set the location of OCR language data files extractor.OCRLanguageDataFolder = @"c:\Program Files\Bytescout PDF Extractor SDK\ocrdata\"; // Set OCR language extractor.OCRLanguage = "eng"; // "eng" for english, "deu" for German, "fra" for French, "spa" for Spanish etc - according to files in "ocrdata" folder // Find more language files at https://github.com/bytescout/ocrdata // Set document rendering resolution extractor.OCRResolution = 300; // You can also apply various preprocessing filters // to improve the recognition on low-quality scans. Console.WriteLine("Please wait while PDF Extractor SDK is processing noisy image to read data..."); // Automatically deskew skewed scans extractor.OCRImagePreprocessingFilters.AddDeskew(); // Remove vertical or horizontal lines (sometimes helps to avoid OCR engine's page segmentation errors) //extractor.OCRImagePreprocessingFilters.AddVerticalLinesRemover(); //extractor.OCRImagePreprocessingFilters.AddHorizontalLinesRemover(); // Repair broken letters extractor.OCRImagePreprocessingFilters.AddDilate(); // Remove noise extractor.OCRImagePreprocessingFilters.AddMedian(); // Apply Gamma Correction extractor.OCRImagePreprocessingFilters.AddGammaCorrection(); // Add Contrast //extractor.OCRImagePreprocessingFilters.AddContrast(20); // (!) You can use new OCRAnalyser class to find an optimal set of image preprocessing // filters for your specific document. // See "OCR Analyser" example. //Read all text string allText = extractor.GetText(); Console.Clear(); Console.WriteLine("Extracted Text: \n\n" + allText); } } catch (Exception ex) { Console.Clear(); Console.WriteLine("Exception: " + ex.Message); } Console.ReadLine(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next