C#/VB.NET讀取條碼類型及條碼在圖片中的坐標(biāo)位置實(shí)例
引入dll
注:讀取時(shí),也支持讀取二維碼類型。
調(diào)用API:Spire.Barcode for .NET
兩種方法:
★1. 在VS中通過“管理NuGet包”,搜索“Spire.Barcode”安裝;
或者通過PM控制臺(tái)安裝:
PM> NuGet\Install-Package Spire.Barcode -Version 6.8.0
★2. 官網(wǎng)下載包,安裝到本地路徑,然后將安裝路徑下的Spire.Barcode.dll手動(dòng)引入到VS程序。
讀取條碼類型及頂點(diǎn)坐標(biāo)
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());
//獲取條形碼圖片中的四個(gè)頂點(diǎn)坐標(biāo)位置
Point[] vertexes = barcodeInfos[i].Vertexes;
//輸出結(jié)果
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())
'獲取條形碼圖片中的四個(gè)頂點(diǎn)坐標(biāo)位置
Dim vertexes As Point() = barcodeInfos(i).Vertexes
'輸出結(jié)果
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讀取結(jié)果

以上就是C#/VB.NET讀取條碼類型及條碼在圖片中的坐標(biāo)位置實(shí)現(xiàn)的詳細(xì)內(nèi)容,更多關(guān)于C#/VB.NET讀取條碼類型坐標(biāo)位置 的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
基于WebClient實(shí)現(xiàn)Http協(xié)議的Post與Get對(duì)網(wǎng)站進(jìn)行模擬登陸和瀏覽實(shí)例
這篇文章主要介紹了基于WebClient實(shí)現(xiàn)Http協(xié)議的Post與Get對(duì)網(wǎng)站進(jìn)行模擬登陸和瀏覽的方法,以實(shí)例形式詳細(xì)分析了WebClient模擬POST與GET登陸與瀏覽的過程,對(duì)于C#項(xiàng)目開發(fā)來說具有不錯(cuò)的參考借鑒價(jià)值,需要的朋友可以參考下2014-11-11
c#獲取兩個(gè)特定字符之間的內(nèi)容并輸出的方法
今天小編就為大家分享一篇c#獲取兩個(gè)特定字符之間的內(nèi)容并輸出的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2018-12-12
C#運(yùn)行程序時(shí)阻止關(guān)閉顯示器和系統(tǒng)待機(jī)
這篇文章介紹了C#運(yùn)行程序時(shí)阻止關(guān)閉顯示器和系統(tǒng)待機(jī)的方法,文中通過示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-06-06
C#實(shí)現(xiàn)把dgv里的數(shù)據(jù)完整的復(fù)制到一張內(nèi)存表的方法
這篇文章主要介紹了C#實(shí)現(xiàn)把dgv里的數(shù)據(jù)完整的復(fù)制到一張內(nèi)存表的方法,需要的朋友可以參考下2014-08-08

