LEADTOOLS使用教程:如何加载,保存和拆分注释

作为许多文档和成像工作流程的重要组成部分,LEADTOOLS Annotations SDK提供了一个界面来标记具有各种形状,注释,突出显示,标尺和修订的图像。本文详细介绍了如何加载,保存和拆分注释。

LEADTOOLS Recognition Imaging SDK是精选的LEADTOOLS SDK功能集,旨在在企业级文档自动化解决方案中构建端到端文档成像应用程序,这些解决方案需要OCR,MICR,OMR,条形码,表单识别和处理,PDF,打印捕获 ,档案,注释和图像查看功能。 这套功能强大的工具利用LEAD屡获殊荣的图像处理技术,智能识别可用于识别和提取任何类型的扫描或传真形式图像数据的文档功能。

LEADTOOLS Recognition Imaging SDK试用版

作为许多文档和成像工作流程的重要组成部分,LEADTOOLS Annotations SDK提供了一个界面来标记具有各种形状,注释,突出显示,标尺和修订的图像,并带有用于永久更改图像或存储信息以撤消和更改注释的选项。

LEADTOOLS注释具有足够的便携性和灵活性,可用于各种不同的图像和文档格式。LEADTOOLS SDK提供的其他注释类型包括私有DICOM数据元素,存储在TIFF标签中的Wang注释,IBM FileNet P8注释,Daeja注释以及PDF标记和注释。注释可以成为数据的永久部分,也可以作为XML,SVG和EMF导出。

下面的代码显示了创建加载,保存和拆分注释的解决方案所需的基础知识。如果您需要完整的分步教程,请查看我们的控制台C#教程:如何加载,保存和拆分注释。

// Add this global variablestatic AnnContainer annContainer;// LOADstatic void LoadTifAnnotationsExample(){   // Load the annotations from the TIFF file   AnnCodecs annCodecs = new AnnCodecs();   annContainer = annCodecs.Load(@"TestFileTifAnnotations.tif", 1);   // Print out the objects in the container to show they are loaded   Console.WriteLine("ANNOTATIONS LOADED: From Test TIF File that Already Contained Annotations:n");   foreach (var annObject in annContainer.Children)   {      Console.WriteLine($"Annotation: {annObject}");   }      Console.WriteLine("n");}// SAVEstatic void SaveTifAnnotationsExample(){   using (RasterCodecs rasterCodecs = new RasterCodecs())   {      AnnCodecs annCodecs = new AnnCodecs();      RasterTagMetadata tag = annCodecs.SaveToTag(annContainer, false);      rasterCodecs.WriteTag(@"SaveAnnotationsToTif.tif", 1, tag);      // Now load the annotations from the TIFF file we just saved to ensure they were saved correctly      AnnContainer savedTifContainer = annCodecs.Load(@"SaveAnnotationsToTif.tif", 1);      // Print out the objects in the container to show they are loaded      Console.WriteLine("ANNOTATIONS LOADED: From TIFF File that we Saved Annotations to:n");      foreach (var annObject in savedTifContainer.Children)      {         Console.WriteLine($"Annotation: {annObject}");      }      Console.WriteLine("n");   }}// SPLITstatic void SplitContainerToTifAndXmlExample(){   // Save all the Rectangle annotations from the container to XML   AnnCodecs annCodecs = new AnnCodecs();   AnnContainer xmlContainer = annContainer.Clone();   for (int i = 0; i < xmlContainer.Children.Count; i++) { if (xmlContainer.Children[i].Id != AnnObject.RectangleObjectId) { xmlContainer.Children.Remove(xmlContainer.Children[i]); i--; } } annCodecs.Save(@"RectangleAnnotationsXml.xml", xmlContainer, AnnFormat.Annotations, 1); // Now load the annotations from the XML file we just saved to ensure they were saved correctly AnnContainer rectangleXmlContainer = annCodecs.Load(@"RectangleAnnotationsXml.xml", 1); // Print out the objects in the container to show they are loaded Console.WriteLine("ANNOTATIONS LOADED: From XML File that we Saved ONLY Rectangle Annotations to:"); foreach (var annObject in rectangleXmlContainer.Children) { Console.WriteLine($"Annotation: {annObject}"); } Console.WriteLine(""); // Save all the Note annotations from the container to TIFF AnnContainer tifContainer = annContainer.Clone(); for (int i = 0; i < tifContainer.Children.Count; i++) { if (tifContainer.Children[i].Id != AnnObject.NoteObjectId) { tifContainer.Children.Remove(tifContainer.Children[i]); i--; } } using (RasterCodecs rasterCodecs = new RasterCodecs()) { RasterTagMetadata tag = annCodecs.SaveToTag(tifContainer, false); rasterCodecs.WriteTag(@"SaveJustNoteAnnotationsToTif.tif", 1, tag); } // Now load the annotations from the XML file we just saved to ensure they were saved correctly AnnContainer noteTifContainer = annCodecs.Load(@"SaveJustNoteAnnotationsToTif.tif", 1); // Print out the objects in the container to show they are loaded Console.WriteLine("ANNOTATIONS LOADED: From TIFF File from which we Saved ONLY Note Annotations to:"); foreach (var annObject in noteTifContainer.Children) { Console.WriteLine($"Annotation: {annObject}"); } Console.WriteLine("n");

试试看!

要自己进行测试,请确保从我们的网站上免费获得最新的LEADTOOLS SDK评估(如果还没有的话)。该试用版有效期为60天,并提供无限制的聊天和电子邮件支持。

支持

需要帮助来获取此样本吗联系我们的支持团队以获取免费技术支持!有关价格或许可问题,您可以联系我们的销售团队。

请继续关注,因为正如我们之前的帖子中所承诺的那样,我们将提供更多教程,程序员可以使用它们来开发直接影响数据捕获、识别、交换和其他紧迫业务需求的应用程序。

试用版下载>>>

LEADTOOLS 使用教程>>>


想要购买LEADTOOLS正版授权,或了解更多产品信息请点击【咨询在线客服】

LEADTOOLS使用教程:如何加载,保存和拆分注释

标签:

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年10月8日
下一篇 2020年10月8日

相关推荐

发表回复

登录后才能评论