Onenote OCR capabilities in a desktop software

2019-02-24 08:22发布

Is there an API to use Onenote OCR capabilities to recognise text in images automatically?

标签: c# ocr onenote
4条回答
戒情不戒烟
2楼-- · 2019-02-24 08:38

There is a really good sample of how to do this here: http://www.journeyofcode.com/free-easy-ocr-c-using-onenote/

The main bit of code is:

private string RecognizeIntern(Image image)
{
    this._page.Reload();

    this._page.Clear();
    this._page.AddImage(image);

    this._page.Save();

    int total = 0;
    do
    {
        Thread.Sleep(PollInterval);

        this._page.Reload();

        string result = this._page.ReadOcrText();
        if (result != null)
            return result;
    } while (total++ < PollAttempts);

    return null;
}
查看更多
看我几分像从前
3楼-- · 2019-02-24 08:48

If you have OneNote client on the same machine as your program will execute you can create a page in OneNote and insert the image through the COM API. Then you can read the page in XML format which will include the OCR'ed text.

You want to use

  1. Application.CreateNewPage to create a page
  2. Application.UpdatePageContent to insert the image
  3. Application.GetPageContent to read the page content and look for OCRData and OCRText elements in the XML.

OneNote COM API is documented here: http://msdn.microsoft.com/en-us/library/office/jj680120(v=office.15).aspx

查看更多
Lonely孤独者°
4楼-- · 2019-02-24 08:49

not sure about OCR, but the documentation site for onenote API is this

http://msdn.microsoft.com/en-us/library/office/dn575425.aspx#sectionSection1

查看更多
疯言疯语
5楼-- · 2019-02-24 09:03

When you put an image on a page in OneNote through the API, any images will automatically be OCR'd. The user will then be able to search any text in the images in OneNote. However, you cannot pull the image back and read the OCR'd text at this point.

If this is a feature that interests you, I invite you to go to our UserVoice site and submit this idea: http://onenote.uservoice.com/forums/245490-onenote-developers

update: vote on the idea: https://onenote.uservoice.com/forums/245490-onenote-developer-apis/suggestions/10671321-make-ocr-available-in-the-c-api

-- James

查看更多
登录 后发表回答