欢迎客人!要启用所有功能,请 登录 注册

通知

图标
错误

选项
视图
最后的去最后一篇 未读的转到第一个未读的帖子
# 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); } }


文件附件:
micr_redact.zip (4 kb)下载129时间(年代)。
哈迪Chami
开发人员支持经理
领德科技有限公司

引导标志

通过下载评估,免费试用最新版本的LEADTOOLS 60天://m.ahtuanjie.com/downloads

想加入讨论吗?登录到您的LEADTOOLS支持帐户 或注册一个新的论坛帐户

#2发布: 2020年3月26日星期四上午9:09:43 (UTC)
路加福音杜瓦尔

组:注册技术支持管理员
职位:34


使用Visual Studio 2019将项目更新为LEADTOOLS Version 20

文件附件:
micr_redact.zip (4 kb)下载40时间(年代)。
路加福音杜瓦尔
开发支持工程师
领德科技有限公司
引导标志
不能在这个论坛上发布新的主题。
不能回复本论坛的话题。
不能删除你在这个论坛上的帖子。
不能在这个论坛编辑你的帖子。
不能在这个论坛中创建民意调查。
不能在这个论坛投票。