C#/VB.NET讀取條碼類型及條碼在圖片中的坐標位置實例
引入dll
注:讀取時,也支持讀取二維碼類型。
調用API:Spire.Barcode for .NET
兩種方法:
★1. 在VS中通過“管理NuGet包”,搜索“Spire.Barcode”安裝;
或者通過PM控制臺安裝:
PM> NuGet\Install-Package Spire.Barcode -Version 6.8.0
★2. 官網下載包,安裝到本地路徑,然后將安裝路徑下的Spire.Barcode.dll手動引入到VS程序。
讀取條碼類型及頂點坐標
C#
using Spire.Barcode; using Spire.Barcode.Settings; using System.Drawing; namespace GetBarcode { class Program { static void Main(string[] args) { //加載條碼圖片 BarcodeInfo[] barcodeInfos = BarcodeScanner.ScanInfo("img.png"); for (int i = 0; i < barcodeInfos.Length; i++) { //獲取條碼類型 BarCodeReadType barCodeReadType = barcodeInfos[i].BarCodeReadType; System.Console.WriteLine("Barcode Type is:" + barCodeReadType.ToString()); //獲取條形碼圖片中的四個頂點坐標位置 Point[] vertexes = barcodeInfos[i].Vertexes; //輸出結果 for(int j = 0; j < vertexes.Length; j++) { System.Console.WriteLine(vertexes[j]); } System.Console.ReadKey(); } } } }
VB.NET
Imports Spire.Barcode Imports Spire.Barcode.Settings Imports System.Drawing Namespace GetBarcode Class Program Private Shared Sub Main(args As String()) '加載條碼圖片 Dim barcodeInfos As BarcodeInfo() = BarcodeScanner.ScanInfo("img.png") For i As Integer = 0 To barcodeInfos.Length - 1 '獲取條碼類型 Dim barCodeReadType As BarCodeReadType = barcodeInfos(i).BarCodeReadType System.Console.WriteLine("Barcode Type is:" + barCodeReadType.ToString()) '獲取條形碼圖片中的四個頂點坐標位置 Dim vertexes As Point() = barcodeInfos(i).Vertexes '輸出結果 For j As Integer = 0 To vertexes.Length - 1 System.Console.WriteLine(vertexes(j)) Next System.Console.ReadKey() Next End Sub End Class End Namespace
讀取結果
以上就是C#/VB.NET讀取條碼類型及條碼在圖片中的坐標位置實現(xiàn)的詳細內容,更多關于C#/VB.NET讀取條碼類型坐標位置 的資料請關注腳本之家其它相關文章!
相關文章
C#使用RichTextBox實現(xiàn)替換文字及改變字體顏色功能示例
這篇文章主要介紹了C#使用RichTextBox實現(xiàn)替換文字及改變字體顏色功能,結合實例形式洗了C#中RichTextBox組件文字替換及改變字體顏色相關操作技巧,需要的朋友可以參考下2019-02-02C#中BitmapImage與BitmapSource接口的區(qū)別對比小結
BitmapImage和BitmapSource都可以用于表示和顯示圖像,本文就來介紹一下C#中BitmapImage與BitmapSource接口的區(qū)別對比,具有一定的參考價值,感興趣的可以了解一下2024-03-03C# 重寫ComboBox實現(xiàn)下拉任意組件的方法
C#種的下拉框ComboBox不支持下拉復選框列表與下拉樹形列表等,系統(tǒng)中需要用到的地方使用了第三方組件,現(xiàn)在需要將第三方組件替換掉。這篇文章主要介紹了C# 重寫ComboBox實現(xiàn)下拉任意組件的相關資料,需要的朋友可以參考下2016-10-10