3

我正在使用 AForge.NET 库进行图像处理。使用这个库,我可以检测图像中的基本形状。如何使用 AForge.NET 库检测图像中的文本?

4

2 回答 2

2

You will need to use Optical Character Recognition (OCR). One link I found on using it with AForge can be visited here. Some code from the link:

// "K" letter, but a little bit noised
float[] pattern = new float [] {
        0.5f, -0.5f, -0.5f,  0.5f,  0.5f,
        0.5f, -0.5f,  0.5f, -0.5f,  0.5f,
        0.5f,  0.5f, -0.5f, -0.5f, -0.5f,
        0.5f, -0.5f,  0.5f, -0.5f, -0.5f,
        0.5f, -0.5f, -0.5f,  0.5f, -0.5f,
        0.3f, -0.5f, -0.5f,  0.5f,  0.5f};

// get network's output
float[] output = neuralNet.Compute(pattern);

int i, n, maxIndex = 0;

// find the maximum from output
float max = output[0];
for (i = 1, n = output.Length; i < n; i++)
{
    if (output[i] > max)
    {
        max = output1[i];
        maxIndex = i;
    }
}

//
System.Diagnostics.Debug.WriteLine(
  "network thinks it is - " + (char)((int) 'A' + maxIndex));

The only other way I can think of doing it, is using Tessaract-OCR which can read a wide variety of image formats and convert them to text in over 40 languages. There are also many other ways of doing it out there, including using Microsoft Office, or Emgu cv.

There's one more link which might work. It detects playing cards in AForge, and while doing so reads the numbers or J, Q, and K in the corner. You may have seen it already.

于 2012-06-30T21:43:09.763 回答
0

使用Microsoft 认知服务 - 计算机视觉 API

光学字符识别 (OCR) 检测图像中的文本并将识别的单词提取到机器可读的字符流中

于 2017-04-06T19:55:36.473 回答