原創(chuàng)|使用教程|編輯:黃竹雯|2017-11-21 13:56:19.000|閱讀 402 次
概述:在使用leadtools進(jìn)行二維碼識別的過程中,經(jīng)常或碰到中文識別為亂碼的情況,讓人比較郁悶,本文教大家如何通過leadtools來讀取二維碼中的中文。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
using Leadtools; using Leadtools.Codecs; using Leadtools.Forms; using Leadtools.Barcode; using Leadtools.ImageProcessing; public void BarcodeData_GetDataExample() { string imageFileName = Path.Combine(LEAD_VARS.ImagesDir, "Barcode2.tif"); // Create a Barcode engine BarcodeEngine engine = new BarcodeEngine(); // Load the image using (RasterCodecs codecs = new RasterCodecs()) { using (RasterImage image = codecs.Load(imageFileName, 0, CodecsLoadByteOrder.BgrOrGray, 1, 1)) { // Read the first QR barcode from the image BarcodeData data = engine.Reader.ReadBarcode(image, LogicalRectangle.Empty, BarcodeSymbology.QR); // Show the barcode data found (if any) if (data != null) { Console.WriteLine("Raw data is:"); byte[] bytes = data.GetData(); if (bytes != null) { string text = System.Text.Encoding.UTF8.GetString(bc); Console.WriteLine(text); } else { Console.WriteLine("Empty"); } } else { Console.WriteLine("No barcode found"); } } } }
試用、下載、了解更多產(chǎn)品信息請點(diǎn)擊""
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn