We regularly create and update our sample code library so you may quickly learn image preprocessing filters with barcode reader sdk and the step-by-step process in C#. ByteScout Premium Suite was made to help with image preprocessing filters with barcode reader sdk in C#. ByteScout Premium Suite is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.
If you want to quickly learn then these fast application programming interfaces of ByteScout Premium Suite for C# plus the guideline and the C# code below will help you quickly learn image preprocessing filters with barcode reader sdk. Follow the steps-by-step instructions from the scratch to work and copy and paste code for C# into your editor. These C# sample examples can be used in one or many applications.
Trial version can be downloaded from our website for free. It contains this and other 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)
using System; using Bytescout.BarCodeReader; namespace ImagePreprocessingFilters { /// <summary> /// This exmaple demonstrates the use of image filters to improve the decoding or speed. /// </summary> class Program { static void Main() { using (Reader reader = new Reader("demo", "demo")) { // Set barcode type to find reader.BarcodeTypesToFind.Code128 = true; // WORKING WITH LOW CONTRAST BARCODE IMAGES // Add contrast adjustment for low-contrast image reader.ImagePreprocessingFilters.AddContrast(40); Console.WriteLine("Image {0}", "low-contrast-barcode.png"); FoundBarcode[] barcodes = reader.ReadFrom("low-contrast-barcode.png"); if (barcodes.Length == 0) Console.WriteLine("No barcode found!"); else foreach (FoundBarcode barcode in barcodes) Console.WriteLine("Found barcode {0} with value '{1}'", barcode.Type, barcode.Value); reader.ImagePreprocessingFilters.Clear(); Console.WriteLine(); // WORKING WITH NOISY BARCODE IMAGES // Add the median filter to lower the noise reader.ImagePreprocessingFilters.AddMedian(); Console.WriteLine("Image {0}", "noisy-barcode.png"); /* ----------------------------------------------------------------------- NOTE: We can read barcodes from specific page to increase performance. For sample please refer to "Decoding barcodes from PDF by pages" program. ----------------------------------------------------------------------- */ barcodes = reader.ReadFrom("noisy-barcode.png"); if (barcodes.Length == 0) Console.WriteLine("No barcode found!"); else foreach (FoundBarcode barcode in barcodes) Console.WriteLine("Found barcode {0} with value '{1}'", barcode.Type, barcode.Value); reader.ImagePreprocessingFilters.Clear(); Console.WriteLine(); // WORKING WITH DENSE AND ILLEGIBLE BARCODES // Add the scale filter to enlarge the barcode to make gaps between bars more distinguishable reader.ImagePreprocessingFilters.AddScale(2d); // enlarge twice Console.WriteLine("Image {0}", "too-dense-barcode.png"); barcodes = reader.ReadFrom("too-dense-barcode.png"); if (barcodes.Length == 0) Console.WriteLine("No barcode found!"); else foreach (FoundBarcode barcode in barcodes) Console.WriteLine("Found barcode {0} with value '{1}'", barcode.Type, barcode.Value); reader.ImagePreprocessingFilters.Clear(); Console.WriteLine(); // REMOVE EMPTY MARGINS FROM IMAGE TO SPEED UP THE PROCESSING // Add the crop filter to cut off empty margins from the image. // This will not improve the recognition quality but may speed up the processing // if you enabled multiple barcode types to search. reader.ImagePreprocessingFilters.AddCropDark(); Console.WriteLine("Image {0}", "barcode-with-large-margins.png"); barcodes = reader.ReadFrom("barcode-with-large-margins.png"); if (barcodes.Length == 0) Console.WriteLine("No barcode found!"); else foreach (FoundBarcode barcode in barcodes) Console.WriteLine("Found barcode {0} with value '{1}'", barcode.Type, barcode.Value); reader.ImagePreprocessingFilters.Clear(); Console.WriteLine(); } Console.WriteLine("Press any key to exit.."); Console.ReadKey(); } } }
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Premium Suite Home Page
Explore ByteScout Premium Suite Documentation
Explore Samples
Sign Up for ByteScout Premium Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: