We know that many languages can read barcodes on the Windows platform, and today we will share in the Barcode Reader SDK How to read barcodes in images with vb.net or C #.
"BarCode Reader SDK Download"
This code demonstrates how to read barcodes from an image and print to the output console.
Visual Basic. NET:
imports system.ioimports bytescout.barcodereader ' requiring to install evaluation or full version of barcode reader sdk<em>module < font class= "Apple-style-span" color= "#000000" ><span data-scayt_word= "Module1" Data-scaytid= "1" >module1</span></font></em>sub main () dim pat as string = "Inputphoto.jpg" Console.WriteLine ("Reading barcode (s) from image {0}", path.getfullpath (PAT)) dim <span data-scayt_word= "BC" data-scaytid= "2" >bc</span > as new reader () BC. Typetofind = symbologyfilter.findalldim barcodes as <span data-scayt_word= " Foundbarcode " data-scaytid=" 3 ">FoundBarcode</span> () = bc. Readfrom (PAT) dim i as integerfor i = 0 to barcodes. Length - 1console.writeline ("found barcode with type ' {0} ' and value ' {1} ', barcodes (i). Type, barcodes (i). Value) Nextconsole.writeline ("Press any key to exit..") Console.readkey () End subend module
C #
Using system;using system.collections.generic;using system.text;using system.io;using Bytescout.BarCodeReader; // requires to have evaluation or full Version of barcode reader sdk installed<span data-scayt_word= "Namespace" data-scaytid= "6" >namespace</span> <span data-scayt_word= "SimpleTestSharp" Data-scaytid= "7" >simpletestsharp</span>{class program{<span data-scayt_word= "Const" data-scaytid= "8" >const</span> string path = "<span data-scayt_word=" "Inputbarcodeimagejpg" data-scaytid= "9" >InputBarcodeImagejpg</span> "Static void main ( string[] <span data-scayt_word= "args" data-scaytid= ">args</span>" { Console.WriteLine ("Reading barcode (s) from image {0}", path.getfullpath (Path)); reader <span data-scayt_word= "BC" &NBsp;data-scaytid= ">bc</span> = new reader" (); <span data-scayt_word= " Foundbarcode " data-scaytid=" ">FOUNDBARCODE</SPAN>[]&NBSP;BARCODES&NBSP;=&NBSP;BC". Readfrom (path); <span data-scayt_word= "foreach" data-scaytid= ">foreach</span> " ( <span data-scayt_word= "Foundbarcode" data-scaytid= ">foundbarcode</span> barcode" in barcodes) Console.WriteLine ("found barcode with type ' {0} ' and value ' {1} ', barcode. Type, barcode. Value); Console.WriteLine ("Press any key to exit."); Console.readkey ();}}}
This article is translated from barcode Reader
This article is from the "294936239" blog, please be sure to keep this source http://294936239.blog.51cto.com/10806039/1707808
BarCode Reader SDK Usage Tutorial: How to read barcodes from images