Browse our Products

Aspose.OCR for C++ 23.9.0 - Release Notes

Deprecation warning

What was changed

KeySummaryCategory
OCRCPP‑512Automatic detection of low-contrast areas of the image where text recognition may be inaccurate or where information may be lost.New feature
OCRCPP‑513Automatic detection of noisy areas of the image where character recognition may result in unwanted artifacts or incorrect character identification.New feature

Public API changes and backwards compatibility

This section lists all public API changes introduced in Aspose.OCR for C++ 23.9.0 that may affect the code of existing applications.

Added public APIs:

The following public APIs have been introduced in this release:

defect_type enumeration

Supported types of image defects that need to be detected:

EnumValueDescription
ASPOSE_OCR_SALT_PEPPER_NOISE1Salt-and-pepper noise (impulse noise) that often occurs in digital photographs taken in low light conditions. It appears as random white and black pixels.
This type of noise can cause certain characters to be misidentified or non-existent characters such as dots or commas to appear in recognition results.
ASPOSE_OCR_DARK_IMAGES2Low contrast between text and background.
Can lead to low recognition accuracy and even the disappearance of entire blocks of text in recognition results.
ASPOSE_OCR_ALL9999All above-mentioned defects.

defect_type recognition setting

This recognition setting allows you to specify the type of image defects that need to be detected. Takes defect_type enumeration values.

AsposeOCRRecognizedPage.defect_areas property

The property of AsposeOCRRecognizedPage structure returned after recognition. Contains the areas of the image (AsposeOCRDefectArea structures) with defects specified in defect_type recognition setting:

MemberTypeDescription
typeAsposeOCRDefectTypeIdentified defect type:
  • AsposeOCRDefectType.ASPOSE_OCR_SALT_PEPPER_NOISE - salt-and-pepper noise (impulse noise).
  • AsposeOCRDefectType.ASPOSE_OCR_DARK_IMAGES - low contrast between text and background.
arearectCoordinates of the image are with defect (top/left corner, width and height).

AsposeOCRRecognizedPage.defects_count property

The property of AsposeOCRRecognizedPage structure returned after recognition. Contains the number (size_t) of areas with defects found on an image.

Updated public APIs:

No changes.

Removed public APIs:

No changes.

Usage examples

The examples below illustrates the changes introduced in this release:

Detecting low-contrast image areas

int main()
{
	// Provide the image  for recognition
	string file = "source.png";
	AsposeOCRInput source;
	source.url = file.c_str();
	vector<AsposeOCRInput> content = {source};
	// Enable detection of low-contrast areas
	RecognitionSettings settings;
	settings.defect_type = defect_type::ASPOSE_OCR_DETECT_DARK_IMAGES;
	// Extract text from the image
	AsposeOCRRecognitionResult result = asposeocr_recognize(content.data(), content.size(), settings);
	// Show low-contrast areas
	print(result);
	// Release the resources
	asposeocr_free_result(result);
}

std::ostream& operator<<(std::ostream& op, const rect& input)
{
	op << "top: " << input.y << "; left: " << input.x << "; width: " << input.width << "; height:" << input.height;
	return op;
}

void print(const AsposeOCRRecognitionResult& input)
{
	for (size_t p_number = 0; p_number < input.pages_amount; ++p_number)
	{
		cout << "Page " << p_number << ";\n";
		const auto& page = input.recognized_pages[p_number];
		for (size_t defect_number = 0; defect_number < page.defects_count; ++defect_number)
		{
			const auto& defect_area = page.defect_areas[defect_number];
			cout << "Low-contrast area " << defect_number << ":" << defect_area.area << std::endl;
		}
	}
}