Microsoft Vision API无法处理OCR

时间:2017-10-19 01:38:44

标签: ocr

我正在使用https://github.com/microsoft/cognitive-vision-windows中的项目,我可以上传图片,但无法处理OCR。它只是停留在“执行OCR ...”上,除了“识别手写文本”

之外的其他功能也是如此
        //
        // Perform OCR on the given url
        //
        Log("Calling VisionServiceClient.RecognizeTextAsync()...");
        OcrResults ocrResult = await VisionServiceClient.RecognizeTextAsync(imageUrl, language);
        return ocrResult;

        // -----------------------------------------------------------------------
        // KEY SAMPLE CODE ENDS HERE
        // -----------------------------------------------------------------------
    }

    /// <summary>
    /// Perform the work for this scenario
    /// </summary>
    /// <param name="imageUri">The URI of the image to run against the scenario</param>
    /// <param name="upload">Upload the image to Project Oxford if [true]; submit the Uri as a remote url if [false];</param>
    /// <returns></returns>
    protected override async Task DoWork(Uri imageUri, bool upload)
    {
        _status.Text = "Performing OCR...";

        string languageCode = (languageComboBox.SelectedItem as RecognizeLanguage).ShortCode;

        //
        // Either upload an image, or supply a url
        //
        OcrResults ocrResult;
        if (upload)
        {
            ocrResult = await UploadAndRecognizeImage(imageUri.LocalPath, languageCode);
        }
        else
        {
            ocrResult = await RecognizeUrl(imageUri.AbsoluteUri, languageCode);
        }
        _status.Text = "OCR Done";

        //
        // Log analysis result in the log window
        //
        Log("");
        Log("OCR Result:");
        LogOcrResults(ocrResult);
    }

0 个答案:

没有答案