Community

Difference between Cloud OCR and FRE SDK (ver. 12)

Hello Fine Reader Team,

 

I have developed application what works with Cloud OCR API.

I use TextRecognition feature.

The Cloud API returns me good result what can be reviewed in attached "Cloud API Results.png" file.

 

Now I try to use FineReader Engine SDK (version 12).

I use TextExtraction_Accuracy predefined profile.

But in this case I see bad recognition results ("FRE SDK Results.png" file).

 

I think I need to set up additional Parameters settings.

But I have tried some settings and combinations... And I have no expected results.

 

What difference between Parameters settings for Cloud API and TextExtraction_Accuracy predefined profile?

0

Comments

1 comment

  • Avatar
    Iv Alex

    My code snippets:

    1) FRE SDK:

    public DocumentModel RecognizeDocument(byte[] imageContent)
    {
        DocumentModel result;

        var engineLoader = new InprocLoader();
        try
        {
            var engine = engineLoader.InitializeEngine(_customerProjectId);
            engine.LoadPredefinedProfile("TextExtraction_Accuracy");

            var document = engine.CreateFRDocument();
            using (var abbyyStream = new AbbyReadStream(imageContent))
            {
                // TODO: (alex) what about PrepareMode?
                document.AddImageFileFromStream(abbyyStream, PrepareMode: null);
            }

            // TODO: (alex) what about DocumentProcessingParams?
            document.Process(null);

            var exportParams = engine.CreateXMLExportParams();
            exportParams.WriteCharAttributes = XMLCharAttributesEnum.XCA_Extended;
            exportParams.WriteCharacterRecognitionVariants = true;

            using (var abbyyStream = new AbbyyFileWriter())
            {
                document.ExportToMemory(abbyyStream, FileExportFormatEnum.FEF_XML, exportParams);
                var data = abbyyStream.Stream.ConvertToArray();
                result = data.DesirializeXml<DocumentModel>();
            }
        }
        finally
        {
            engineLoader.ExplicitlyUnload();
        }

        return result;
    }

     

    2) OCR API:

    public TaskModel CreateRecognitionTask(byte[] imageContent, LanguageEnum language)
    {
        var client = new RestClient(Domain);

        var request = new RestRequest($"/processImage?profile=textExtraction&exportFormat=xml&xml:writeRecognitionVariants=true&readBarcodes=false&language={language}")
        {
            Method = Method.POST
        };

        AddAuthorizationHeader(request);

        request.XmlSerializer = new DotNetXmlSerializer();
        request.AddParameter("application/octet-stream", imageContent, ParameterType.RequestBody);

        var response = client.Execute<TaskResponseModel>(request);
        ThrowExceptionIfNeeded(response);

        return response.Data.Task;
    }

         
    0
    Comment actions Permalink

Please sign in to leave a comment.