【问题标题】:OCR image with text using Leadtools + VB.Net to find Location/Coordinates of Specific text on Image使用 Leadtools + VB.Net 查找带有文本的 OCR 图像在图像上查找特定文本的位置/坐标
【发布时间】:2018-08-22 10:13:05
【问题描述】:

我只能找到使用 C# 的代码,但也许有人可以将其翻译成 vb.net 或协助 VB.NET 代码可以帮助我。我只是一个使用 VB.net 的初学者。我去了leadtools论坛,但是没有我想要的例子,而且大多数例子都是用C#写的

    void HiliteWord(AnnContainer container, IOcrPage page, OcrWord word)
{
    // Get bounds of word as LeadRectD
    LeadRectD bounds = word.Bounds.ToRectangle(page.DpiX, page.DpiY).ToLeadRectD();
    // Convert to annotation coordinates
    bounds = container.Mapper.RectToContainerCoordinates(bounds);
    // Create the annotation
    AnnHiliteObject hilite = new AnnHiliteObject();
    hilite.Points.Clear();
    hilite.Points.Add(bounds.TopLeft);
    hilite.Points.Add(bounds.TopRight);
    hilite.Points.Add(bounds.BottomRight);
    hilite.Points.Add(bounds.BottomLeft);
    // Add to container
    container.Children.Add(hilite);
}

【问题讨论】:

  • 看看converter.telerik.com 这个站点将允许您粘贴代码并单击转换按钮 - 将其添加到您的书签中
  • 顺便说一句.. 欢迎来到 Stack Overflow。在这里正确提问非常重要。看看How to Askminimal reproducible example。就目前而言,您的问题是题外话,因为这不是询问代码翻译。它是针对有关现有代码的特定问题的问题。不要让反对票或关闭票让你失望​​。谢谢

标签: vb.net position ocr leadtools-sdk


【解决方案1】:

正如 David 在他的 cmets 中所说,您可以使用在线转换器将 c# 转换为 vb.net。此外,如果您需要 SDK 方面的帮助,LEADTOOLS SDK 提供聊天、电子邮件和论坛作为支持选项:

https://www.leadtools.com/support/supportoptions

我在 David 链接的转换器中运行了上述代码,这是正确的输出,可以在您的应用程序中使用:

Private Sub HiliteWord(ByVal container As AnnContainer, ByVal page As IOcrPage, ByVal word As OcrWord)
    Dim bounds As LeadRectD = word.Bounds.ToRectangle(page.DpiX, page.DpiY).ToLeadRectD()
    bounds = container.Mapper.RectToContainerCoordinates(bounds)
    Dim hilite As AnnHiliteObject = New AnnHiliteObject()
    hilite.Points.Clear()
    hilite.Points.Add(bounds.TopLeft)
    hilite.Points.Add(bounds.TopRight)
    hilite.Points.Add(bounds.BottomRight)
    hilite.Points.Add(bounds.BottomLeft)
    container.Children.Add(hilite)
End Sub

【讨论】:

猜你喜欢
  • 2020-03-12
  • 1970-01-01
  • 2013-08-07
  • 1970-01-01
  • 2020-10-05
  • 1970-01-01
  • 2011-02-24
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多