Onenote OCR capabilities in a desktop software

假装没事ソ 提交于 2019-12-07 04:17:05

问题


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


回答1:


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




回答2:


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




回答3:


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;
}



回答4:


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

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



来源:https://stackoverflow.com/questions/25264237/onenote-ocr-capabilities-in-a-desktop-software

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!