LEADTOOLS (Lead Technology)由Moe Daher and Rich Little创建于1990年,其总部设在北卡罗来纳州夏洛特。LEAD的建立是为了使Daher先生在数码图象与压缩技术领域的发明面向市场。在过去的发展历程中,LEAD以其在全世界主要国家中占有的市场领导地位,在数码图象开发工具领域中已成为既定的全球领导者。LEADTOOLS开发与发布的LEAD是屡获殊荣的开发工具包。
点击了解LEADTOOLS详情
很少有人喜欢共享他们的个人信息,我保证也没有人喜欢共享文件中的私人信息。每天都会在大公司之间发送财务文件的图像,例如支票。在任何可以上传到互联 并在几秒钟内被盗的世界中,您永远不会过于谨慎地保护个人信息。
首先,设置AnnContainer。这个容器最终会覆盖支票上的私人信息。
// Initialize the rendering engineAnnWinFormsRenderingEngine renderingEngine = new AnnWinFormsRenderingEngine();string dir = Path.Combine(Path.GetDirectoryName(file), "Redacted");// Check if directory exists, if not create it.if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);string outFile = Path.Combine(dir, Path.GetFileNameWithoutExtension(file) + "_redacted.tif");// Get total pages found in image and look for MICR zoneint totalPages = codecs.GetTotalPages(file);for (int i = 1; i <= totalPages; i++) using (RasterImage image = codecs.Load(file, i)){}
接下来,添加代码以检测检查中发现的MICR区域和CMC7区域。此代码将从上面进入using语句。
MICRCodeDetectionCommand detectionCommand = new MICRCodeDetectionCommand();detectionCommand.Run(image);if (detectionCommand.MICRZone != LeadRect.Empty && detectionCommand.MICRZone.Width > 0 && detectionCommand.MICRZone.Height > 0){ AnnRedactionObject redaction = new AnnRedactionObject { Rect = container.Mapper.RectToContainerCoordinates(detectionCommand.MICRZone.ToLeadRectD()), Fill = AnnSolidColorBrush.Create("Black") }; container.Children.Add(redaction);}
CMC7CodeDetectionCommand cmc7DetectionCommand = new CMC7CodeDetectionCommand();cmc7DetectionCommand.Run(image);if (cmc7DetectionCommand.CMC7Zone != LeadRect.Empty && cmc7DetectionCommand.CMC7Zone.Width > 0 && cmc7DetectionCommand.CMC7Zone.Height > 0){ AnnRedactionObject redaction = new AnnRedactionObject { Rect = container.Mapper.RectToContainerCoordinates(cmc7DetectionCommand.CMC7Zone.ToLeadRectD()), Fill = AnnSolidColorBrush.Create("Black") }; container.Children.Add(redaction);}
var img = renderingEngine.RenderOnImage(container, image.Clone());codecs.Save(img, outFile, RasterImageFormat.TifJpeg411, 24, 1, 1, 1, CodecsSavePageMode.Append);
之前:

之后:

LEADTOOLS Imaging Pro Developer Toolkit、LEADTOOLS Document Imaging Suite Developer Toolkit、LEADTOOLS Medical Imaging Developer Toolkit是LEADTOOLS的产品,点击查看产品详情
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!