LEADTOOLS v18多平台条码识别(代码示例)

LEADTOOLS v18即LEADTOOLS Anywhere)将其世界领先的成像技术扩展到了WinRT、iOS、Android、Windows Phone和Linux等平台。不仅如此,用户还可以在所有流行平台中实现查看、注释和标记、OCR、条形码、PDF、图像格式、压缩和图像处理等功能。

LEADTOOLS在每个开发平台上面都提供了一组非常相似的开发库,这是LEADTOOLS的一个非常明显的优势,让开发者既能够开发原生的应用程序,又不用花费太多的时间进行完全的代码重写。

LEADTOOLS Anywhere功能

  • 提供了专门针对.NET, HTML5, WinRT, Windows Phone, iOS, OS X和Android的图像查看器;
  • 支持加载、转换和保存超过150种图像格式;
  • 支持条形码读写,包括:QR码,PDF417,二维码,UPC/EAN等;
  • OCR将图像转换为可搜索的文本,PDF,DOC;
  • 全面的注释和标记,包括几何形状,便条,编校,亮点和橡皮图章;
  • 拥有超过200多种图像处理功能,如图像增强,图像纠偏等

接下来,我们就一起展示一下LEADTOOLS Anywhere如何在每个平台上面读取条形码。

.NET

1System.Drawing.Bitmap bitmap = ... // 2// Get a LEADTOOLS RasterImage from the platform image 3RasterImage rasterImage = RasterImageConverter.FromImage(bitmap); 4// Create a LEADTOOLS Barcode Engine instance 5private BarcodeEngine barcodeEngine = new BarcodeEngine(); 6// Read the first barcode found in the image 7BarcodeData barcodeData = barcodeEngine.Reader.ReadBarcode(rasterImage, 8LogicalRectangle.Empty, BarcodeSymbology.Unknown); 9// For this example, simply output the barcode type, location and data in the console 10if (barcodeData != null) { 11Console.WriteLine("Symbology:{0}", barcodeData.Symbology); 12Console.WriteLine("Location:{0},{1},{2},{3}", barcodeData.Bounds.X, 13barcodeData.Bounds.Y, barcodeData.Bounds.Width, barcodeData.Bounds.Height); 14Console.WriteLine("Value:{0}", barcodeData.Value); 15} else { 16Console.WriteLine("No barcodes found"); 17}

LEADTOOLS v18多平台条码识别代码示例

WinRT & Windows Phone

1Windows.UI.Xaml.Media.ImageSource imageSource = ... // 2// Get a LEADTOOLS RasterImage from the platform image 3RasterImage rasterImage = RasterImageConverter.ConvertFromImageSource( 4imageSource, ConvertFromImageOptions.None); 5// Create a LEADTOOLS Barcode Engine instance 6private BarcodeEngine barcodeEngine = new BarcodeEngine(); 7// Read the first barcode found in the image 8BarcodeData barcodeData = barcodeEngine.Reader.ReadBarcode(rasterImage, 9LogicalRectangle.Empty, BarcodeSymbology.Unknown); 10// For this example, simply output the barcode type, location and data in the console 11if (barcodeData != null) { 12Console.WriteLine("Symbology:{0}", barcodeData.Symbology); 13Console.WriteLine("Location:{0},{1},{2},{3}", barcodeData.Bounds.X, 14barcodeData.Bounds.Y, barcodeData.Bounds.Width, barcodeData.Bounds.Height); 15Console.WriteLine("Value:{0}", barcodeData.Value); 16} else { 17Console.WriteLine("No barcodes found"); 18}

LEADTOOLS v18多平台条码识别代码示例

iOS & OS X

1UIImage* uiImage = ... // 2// Get a LEADTOOLS RasterImage from the platform image 3LTRasterImage* rasterImage = [LTRasterImageConverter convertFromImage:uiImage 4options:LTConvertFromImageOptions_None error:nil]; 5// Create a LEADTOOLS Barcode Engine instance 6LTBarcodeEngine* barcodeEngine = [LTBarcodeEngine new]; 7// Read the first barcode found in the image 8LTBarcodeData* barcodeData = [barcodeEngine.reader readBarcode:rasterImage 9searchBounds:LeadRect_Empty() symbologies:nil symbologiesCount:0 error:nil]; 10// For this example, simply retrieve the barcode type, location and data 11if(barcodeData != nil) { 12NSLog(@"Symbology:%u", barcodeData.symbology); 13NSLog(@"Location:%u,%u,%u,%u", barcodeData.bounds.x, barcodeData.bounds.y, 14barcodeData.bounds.width, barcodeData.bounds.height); 15NSLog(@"Value:%@", barcodeData.value); 16} else { 17NSLog(@"No barcodes found"); 18}

LEADTOOLS v18多平台条码识别代码示例

Android

1android.graphics.Bitmap bitmap = ... // 2// Get a LEADTOOLS RasterImage from the platform image 3RasterImage rasterImage = RasterImageConverter.convertFromBitmap( 4bitmap, ConvertFromImageOptions.NONE); 5// Create a LEADTOOLS Barcode Engine instance 6private BarcodeEngine barcodeEngine = new BarcodeEngine(); 7// Read the first barcode found in the image 8BarcodeData barcodeData = barcodeEngine.getReader().readBarcode( 9rasterImage, LeadRect.getEmpty(), BarcodeSymbology.UNKNOWN); 10// For this example, simply output the barcode type, location and data in the console 11if (barcodeData != null) { 12Log.i("LEADTOOLS.BarcodeDemo", String.format("Symbology:%s", barcodeData.getSymbology())); 13Log.i("LEADTOOLS.BarcodeDemo", String.format("Location:%1$s,%2$s,%3$s,%4$s", 14barcodeData.getBounds().getX(), barcodeData.getBounds().getY(), 15barcodeData.getBounds().getWidth(), barcodeData.getBounds().getHeight())); 16Log.i("LEADTOOLS.BarcodeDemo", String.format("Value:%s", barcodeData.getValue())); 17} else { 18Log.i("LEADTOOLS.BarcodeDemo", "No barcodes found"); 19}
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

swap空间的增减方法

(1)增大swap空间去激活swap交换区:swapoff v /dev/vg00/lvswap扩展交换lv:lvextend L 10G /dev/vg00/lvswap重新生成swap交换区:mkswap /dev/vg00/lvswap激活新生成的交换区:swapon v /dev/vg00/lvswap