ByteScout Barcode Reader SDK - VB.NET - Barcode Image Preprocessing Filters - ByteScout

ByteScout Barcode Reader SDK – VB.NET – Barcode Image Preprocessing Filters

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – VB.NET – Barcode Image Preprocessing Filters

barcode image preprocessing filters in VB.NET and ByteScout BarCode Reader SDK

Write code in VB.NET to make barcode image preprocessing filters with this How-To tutorial

The documentation is designed to help you to implement the features on your side. ByteScout BarCode Reader SDK was made to help with barcode image preprocessing filters in VB.NET. ByteScout BarCode Reader SDK is the barcode decoder with support for code 39, code 128, QR Code, Datamatrix, GS1, PDF417 and all other popular barcodes. Can read barcodes from images, pdf, tiff documents and live web camera. Supports noisy and damaged documents, can split and merge pdf and tiff documents based on barcodes. Can export barcode decoder results to XML, JSON, CSV and into custom data structures.

The SDK samples like this one below explain how to quickly make your application do barcode image preprocessing filters in VB.NET with the help of ByteScout BarCode Reader SDK. To do barcode image preprocessing filters in your VB.NET project or application you may simply copy & paste the code and then run your app! Code testing will allow the function to be tested and work properly with your data.

Free trial version of ByteScout BarCode Reader SDK is available on our website. Get it to try other samples for VB.NET.

Try it today: Get 60 Day Free Trial or sign up for Web API

ImagePreprocessingFilters.VS2005.vbproj
      
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>8.0.50727</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{75D64BA4-2691-4BBA-A89D-B575EE05AB63}</ProjectGuid> <OutputType>Exe</OutputType> <StartupObject>ImagePreprocessingFilters.Module1</StartupObject> <RootNamespace>ImagePreprocessingFilters</RootNamespace> <AssemblyName>ImagePreprocessingFilters</AssemblyName> <MyType>Console</MyType> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <DefineDebug>true</DefineDebug> <DefineTrace>true</DefineTrace> <OutputPath>bin\Debug\</OutputPath> <DocumentationFile>ImagePreprocessingFilters.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <DefineDebug>false</DefineDebug> <DefineTrace>true</DefineTrace> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DocumentationFile>ImagePreprocessingFilters.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <ItemGroup> <Reference Include="Bytescout.BarCodeReader, Version=8.20.0.1340, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Bytescout BarCode Reader SDK\net2.00\Bytescout.BarCodeReader.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Deployment" /> <Reference Include="System.Drawing" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Import Include="Microsoft.VisualBasic" /> <Import Include="System" /> <Import Include="System.Collections" /> <Import Include="System.Collections.Generic" /> <Import Include="System.Data" /> <Import Include="System.Diagnostics" /> </ItemGroup> <ItemGroup> <Compile Include="Module1.vb" /> </ItemGroup> <ItemGroup> <Content Include="barcode-with-large-margins.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="low-contrast-barcode.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="noisy-barcode.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="too-dense-barcode.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

Try it today: Get 60 Day Free Trial or sign up for Web API

ImagePreprocessingFilters.VS2008.vbproj
      
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{75D64BA4-2691-4BBA-A89D-B575EE05AB63}</ProjectGuid> <OutputType>Exe</OutputType> <StartupObject>ImagePreprocessingFilters.Module1</StartupObject> <RootNamespace>ImagePreprocessingFilters</RootNamespace> <AssemblyName>ImagePreprocessingFilters</AssemblyName> <MyType>Console</MyType> <OldToolsVersion>2.0</OldToolsVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <DefineDebug>true</DefineDebug> <DefineTrace>true</DefineTrace> <OutputPath>bin\Debug\</OutputPath> <DocumentationFile>ImagePreprocessingFilters.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <DefineDebug>false</DefineDebug> <DefineTrace>true</DefineTrace> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DocumentationFile>ImagePreprocessingFilters.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <ItemGroup> <Reference Include="Bytescout.BarCodeReader, Version=8.20.0.1340, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Bytescout BarCode Reader SDK\net3.50\Bytescout.BarCodeReader.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Deployment" /> <Reference Include="System.Drawing" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Import Include="Microsoft.VisualBasic" /> <Import Include="System" /> <Import Include="System.Collections" /> <Import Include="System.Collections.Generic" /> <Import Include="System.Data" /> <Import Include="System.Diagnostics" /> </ItemGroup> <ItemGroup> <Compile Include="Module1.vb" /> </ItemGroup> <ItemGroup> <Content Include="barcode-with-large-margins.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="low-contrast-barcode.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="noisy-barcode.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="too-dense-barcode.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

Try it today: Get 60 Day Free Trial or sign up for Web API

ImagePreprocessingFilters.VS2010.vbproj
      
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion> </ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{75D64BA4-2691-4BBA-A89D-B575EE05AB63}</ProjectGuid> <OutputType>Exe</OutputType> <StartupObject>ImagePreprocessingFilters.Module1</StartupObject> <RootNamespace>ImagePreprocessingFilters</RootNamespace> <AssemblyName>ImagePreprocessingFilters</AssemblyName> <MyType>Console</MyType> <OldToolsVersion>3.5</OldToolsVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <DefineDebug>true</DefineDebug> <DefineTrace>true</DefineTrace> <OutputPath>bin\Debug\</OutputPath> <DocumentationFile>ImagePreprocessingFilters.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <DefineDebug>false</DefineDebug> <DefineTrace>true</DefineTrace> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DocumentationFile>ImagePreprocessingFilters.xml</DocumentationFile> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> </PropertyGroup> <ItemGroup> <Reference Include="Bytescout.BarCodeReader, Version=8.20.0.1340, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>C:\Program Files\Bytescout BarCode Reader SDK\net4.00\Bytescout.BarCodeReader.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Deployment" /> <Reference Include="System.Drawing" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Import Include="Microsoft.VisualBasic" /> <Import Include="System" /> <Import Include="System.Collections" /> <Import Include="System.Collections.Generic" /> <Import Include="System.Data" /> <Import Include="System.Diagnostics" /> </ItemGroup> <ItemGroup> <Compile Include="Module1.vb" /> </ItemGroup> <ItemGroup> <Content Include="barcode-with-large-margins.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="low-contrast-barcode.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="noisy-barcode.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="too-dense-barcode.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

Try it today: Get 60 Day Free Trial or sign up for Web API

Module1.vb
      
Imports Bytescout.BarCodeReader Module Module1 ''' <summary> ''' This exmaple demonstrates the use of image filters to improve the decoding or speed. ''' </summary> Sub Main() Using reader As New Reader("demo", "demo") ' Set barcode type to find reader.BarcodeTypesToFind.Code128 = True ' WORKING WITH LOW CONTRAST BARCODE IMAGES ' Add the contrast adjustment for the low contrast image reader.ImagePreprocessingFilters.AddContrast(40) Console.WriteLine("Image {0}", "low-contrast-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. ' ----------------------------------------------------------------------- Dim barcodes As FoundBarcode() = reader.ReadFrom("low-contrast-barcode.png") If barcodes.Length = 0 Then Console.WriteLine("No barcode found!") Else For Each barcode As FoundBarcode In barcodes Console.WriteLine("Found barcode {0} with value '{1}'", barcode.Type, barcode.Value) Next End If 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") barcodes = reader.ReadFrom("noisy-barcode.png") If barcodes.Length = 0 Then Console.WriteLine("No barcode found!") Else For Each barcode As FoundBarcode In barcodes Console.WriteLine("Found barcode {0} with value '{1}'", barcode.Type, barcode.Value) Next End If 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(2) ' enlarge twice Console.WriteLine("Image {0}", "too-dense-barcode.png") barcodes = reader.ReadFrom("too-dense-barcode.png") If barcodes.Length = 0 Then Console.WriteLine("No barcode found!") Else For Each barcode As FoundBarcode In barcodes Console.WriteLine("Found barcode {0} with value '{1}'", barcode.Type, barcode.Value) Next End If 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 Then Console.WriteLine("No barcode found!") Else For Each barcode As FoundBarcode In barcodes Console.WriteLine("Found barcode {0} with value '{1}'", barcode.Type, barcode.Value) Next End If reader.ImagePreprocessingFilters.Clear() Console.WriteLine() End Using Console.WriteLine("Press any key to exit..") Console.ReadKey() End Sub End Module

Try it today: Get 60 Day Free Trial or sign up for Web API

MORE INFORMATION

Get 60 Day Free Trial or Visit ByteScout BarCode Reader SDK page

Explore ByteScout BarCode Reader SDK documentation

WEB API VERSION

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next