Browse our Products
Aspose.OCR for CPP 21.4 Release Notes
All Features
Key | Summary | Category |
---|---|---|
OCRCPP-171 | Add .docx and .txt formats to save the recognition result | Enhancement |
OCRCPP-172 | Add the ability to set a threshold value | Enhancement |
Enhancements
- added ability to save the recognition result in the Microsoft Word Document format and in plain text
- added custom image quality correction with parameter threshold_value
Public API and Backwards Incompatible Changes
New API
Function | Description |
---|---|
void asposeocr_page_save( const char* image_path, const char* save_path, RecognitionSettings settings); | Optical character recognition image from file and saving result as a document Parameters: image_path - path to image RecognitionSettings settings - allow to set: new options: |
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 image
std::filesystem::path image = path.string() + "/p.png";
// Prepare buffer for result (in symbols, len_byte = len * sizeof(wchar_t))
const size_t len = 4096;
wchar_t buffer[len] = { 0 };
/* asposeocr_page_from_uri*/
const char* uri = "https://www.castlegateit.co.uk/wp-content/uploads/2016/09/justified_text.png";
RecognitionSettings settings;
settings.threshold_value = 80;
size_t res_len = asposeocr_page_from_uri(uri, buffer, len, settings);
std::wcout << buffer;
/* asposeocr_page_save*/
settings.threshold_value = 0; //- means avto calculation
settings.save_format = file_format::docx;
asposeocr_page_save(image.string().c_str(), "res_ocr.docx", settings);
}