LEADTOOLS如何加载,保存和拆分注释

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

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 variable
static AnnContainer annContainer;


// LOAD
static 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");
}

// SAVE
static 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");
   }
}

// SPLIT
static 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正版授权,或了解更多产品信息请点击【咨询在线客服】

本文章转载自【慧都科技】evget欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,尊重他人劳动成果
原文链接:https://www.evget.com/article/2020/11/11/39105.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值