C#/VB.NET讀取條碼類型及條碼在圖片中的坐標(biāo)位置實(shí)例
引入dll
注:讀取時(shí),也支持讀取二維碼類型。
調(diào)用API:Spire.Barcode for .NET
兩種方法:
★1. 在VS中通過(guò)“管理NuGet包”,搜索“Spire.Barcode”安裝;
或者通過(guò)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)文章
C#環(huán)形隊(duì)列的實(shí)現(xiàn)方法詳解
這篇文章先是簡(jiǎn)單的給大家介紹了什么是環(huán)形隊(duì)列和環(huán)形隊(duì)列的優(yōu)點(diǎn),然后通過(guò)實(shí)例代碼給大家介紹C#如何實(shí)現(xiàn)環(huán)形隊(duì)列,有需要的朋友們可以參考借鑒,下面來(lái)一起看看吧。2016-09-09關(guān)于C#基礎(chǔ)知識(shí)回顧--反射(一)
其實(shí)說(shuō)白了,反射就是能知道我們未知類型的類型信息這么一個(gè)東西.沒(méi)什么神秘可講!反射的核心是System.Type。System.Type包含了很多屬性和方法,使用這些屬性和方法可以在運(yùn)行時(shí)得到類型信息2013-07-07C#使用RichTextBox實(shí)現(xiàn)替換文字及改變字體顏色功能示例
這篇文章主要介紹了C#使用RichTextBox實(shí)現(xiàn)替換文字及改變字體顏色功能,結(jié)合實(shí)例形式洗了C#中RichTextBox組件文字替換及改變字體顏色相關(guān)操作技巧,需要的朋友可以參考下2019-02-02C#中BitmapImage與BitmapSource接口的區(qū)別對(duì)比小結(jié)
BitmapImage和BitmapSource都可以用于表示和顯示圖像,本文就來(lái)介紹一下C#中BitmapImage與BitmapSource接口的區(qū)別對(duì)比,具有一定的參考價(jià)值,感興趣的可以了解一下2024-03-03C# 重寫ComboBox實(shí)現(xiàn)下拉任意組件的方法
C#種的下拉框ComboBox不支持下拉復(fù)選框列表與下拉樹(shù)形列表等,系統(tǒng)中需要用到的地方使用了第三方組件,現(xiàn)在需要將第三方組件替換掉。這篇文章主要介紹了C# 重寫ComboBox實(shí)現(xiàn)下拉任意組件的相關(guān)資料,需要的朋友可以參考下2016-10-10c#實(shí)現(xiàn)windows遠(yuǎn)程桌面連接程序代碼
本篇文章主要介紹了c#實(shí)現(xiàn)windows遠(yuǎn)程桌面連接程序代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-05-05