Browse our Products

Aspose.OCR for CPP 20.4 Release Notes

Aspose.OCR for C++ is a cross-platform C++ library for optical character recognition and document scanning. It allows you to scan documents and recognize characters. Recognized text in English charset.

Prerequisite

Aspose OCR library required onnxruntime.dll in the system path.

Recognize charset

“EN”

Input formats

  • bmp
  • jpg
  • png

Aspose OCR API

Note: all function in the ‘aspose::ocr’ namespace.

FunctionDescription
void set_license(const char* licenseFullPath)licenseFullPath - path to xml license file.
bool get_state()Return license status.
const wchar_t* recognize_page(const char* image_path)Support jpg, bmp, and png format files.
const wchar_t* recognize_line(const char* image_path)Support jpg, bmp, and png format files.
double get_skew(const char* image_path)Calculate the skew angle.

Supported Characters

space!"#$%&'()
*+,-./012
456789:;<=
>?@[|]_`{ 
}~ABCDEFG
IJKLMNOPQR
STUVWXYZa
cdefghijk
mnopqrstu
wxyzÂÀÁÃÄÆ 
ÇÈÉÊËÌÍÎÏÑ 
ÒÓÔÕÖÙÚÛÜẞ 
ßàáâãäæçèé 
êëìíîïñòóô 
õöùúûüÿŒœŸ 

Example (C++17 since filesystem)

 #include <iostream>

#include <filesystem>

#include "aspose_ocr.h"

using namespace std;

int main()

{

	//Current directory

    const filesystem::path path{ filesystem::current_path() };

	//Set license

    const string lic = "/Aspose.Total.lic";

    filesystem::path license = path.string() + lic;

    aspose::ocr::set_license(license.string().c_str());

	//Recognize image

    filesystem::path image = path.string() + "/image.png";

    const wchar_t* result = aspose::ocr::recognize_page(image.string().c_str());

	//Print result

    wcout << result;

}