Browse our Products

Aspose.OCR for CPP 22.1 Release Notes

All Features

KeySummaryCategory
OCRCPP-235Add multipage TIFF input supportEnhancement

Enhancements

  • Added ability to recognize multi-page TIFF images.

Public API and Backwards Incompatible Changes

New API

FunctionDescription
size_t asposeocr_page_tiff(const char* image_path, wchar_t* result, size_t buffer_size, RecognitionSettings settings)

settings - Settings for the image recognition. Contains elements that allow customizing the recognition process. 

Fields: - all_image (true/false) - turning on means recognizing the image as a single area - correct_skew - detects orientation and auto-rotate image if needed - alphabet - set of allowed characters in the alphabet (symbols for recognition). L"" by default (all alphabet allowed) - format - export_format. Allowed options - text or JSON. In JSON format for rectangles, you will get the extended result with areas coordinates and text in these areas - rectangles - an array of rect structure to set areas for recognition - rectangles_size - the size of rectangles array - skew - rotate image on specified angle. Doesn’t work if rectangles are specified - language_alphabet - language used for OCR. Supported languages: English (en), German (de), Portuguese (pt), Spanish (es), French (fr), Italian (it). Multi-language by default. - ignoredCharacters - sets blacklist for recognition symbols. L"" by default (all alphabet allowed)

- image_path - full path to the image in tiff(tif) format.  - result - buffer to save result.  - buffer_size - size of the fuffer. 

returns size of the recognized text. 

size_t aspose::ocr::page_tiff( const char* image_path, wchar_t* result, size_t buffer_size, RecognitionSettings settings)

settings - Settings for the image recognition. Contains elements that allow customizing the recognition process. 

Fields: - all_image (true/false) - turning on means recognizing the image as a single area - correct_skew - detects orientation and auto-rotate image if needed - alphabet - set of allowed characters in the alphabet (symbols for recognition). L"" by default (all alphabet allowed) - format - export_format. Allowed options - text or JSON. In JSON format for rectangles, you will get the extended result with areas coordinates and text in these areas - rectangles - an array of rect structure to set areas for recognition - rectangles_size - the size of rectangles array - skew - rotate image on specified angle. Doesn’t work if rectangles are specified - language_alphabet - language used for OCR. Supported languages: English (en), German (de), Portuguese (pt), Spanish (es), French (fr), Italian (it). Multi-language by default. - ignoredCharacters - sets blacklist for recognition symbols. L"" by default (all alphabet allowed)

- image_path - full path to the image in tiff(tif) format.  - result - buffer to save result.  - buffer_size - size of the fuffer. 

returns size of the recognized text. 

Removed APIs

No Changes

Example (C++17 since filesystem)

#include <iostream>
#include <aspose_ocr.h>
#include <filesystem>
#include <corecrt_io.h>
#include <fcntl.h>
int main()
{
_setmode(_fileno(stdout), _O_U16TEXT);
//Current directory const
std::filesystem::path path{ std::filesystem::current_path() };
/* asposeocr_set_license */
const std::string lic = "/Aspose.Total.lic";
std::filesystem::path license = path.string() + lic;
asposeocr_set_license(license.string().c_str());
/* asposeocr_set_license */
bool lic_result = asposeocr_get_state();

//Recognize TIFF image

// Prepare buffer for result (in symbols, len_byte = len * sizeof(wchar_t))
const size_t len = 4096;
wchar_t buffer[len] = { 0 };

/* asposeocr_page_tiff*/

RecognitionSettings settings;
   settings.all_image = true;

size_t res_len = asposeocr_page_tiff("img.tiff", buffer, len, settings);
std::wcout << buffer;
}