本主题及其回复是在当前版本的LEADTOOLS发布之前发布的,可能不再适用。
# 1发布:
2019年5月14日星期二下午1:42:14 (UTC)
组:经理,技术支持,管理员
帖子:217
被感谢:在12个帖子中12次
附加的是一个项目,将加载给定目录中的所有文件,并尝试检测是否有任何micr存在使用
MICRCodeDetectionCommand而且
CMC7CodeDetectionCommand命令。
一旦在每个页面上找到区域,就会添加一个编校注释,并将其刻录到图像中,然后保存下来。以下是相关代码:
代码:
static void DetectRedact(字符串文件){AnnWinFormsRenderingEngine renderingEngine =新的AnnWinFormsRenderingEngine();var dir = Path.Combine(Path.GetDirectoryName(file), "已编辑");if (!Directory.Exists(dir))string outFile =路径。Combine(dir, Path.GetFileNameWithoutExtension(file) + "_redacted.tif");int totalPages = codecs.GetTotalPages(文件);For (int I = 1;i <= totalPages;i++)使用(RasterImage图像=编解码器。加载(文件,i)) {AnnContainer容器=新的AnnContainer(); container.Mapper.MapResolutions(image.XResolution, image.YResolution, image.XResolution, image.YResolution); container.Size = container.Mapper.SizeToContainerCoordinates(image.ImageSize.ToLeadSizeD()); 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); } }
哈迪Chami
开发人员支持经理
领德科技有限公司
#2发布:
2020年3月26日星期四上午9:09:43 (UTC)
使用Visual Studio 2019将项目更新为LEADTOOLS Version 20
路加福音杜瓦尔
开发支持工程师
领德科技有限公司
你不能在这个论坛上发布新的主题。
你不能回复本论坛的话题。
你不能删除你在这个论坛上的帖子。
你不能在这个论坛编辑你的帖子。
你不能在这个论坛中创建民意调查。
你不能在这个论坛投票。