Aspose.OCR for Java 23.2.0 - Release Notes

What was changed

Key Summary Category
OCRJAVA-310
OCRJAVA-312
Added a preprocessing filter that corrects geometric distortions on an image.
See Added public APIs for important details.
New feature

Public API changes and backwards compatibility

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

Added public APIs:

The following public APIs have been introduced in this release:

PreprocessingFilter.AutoDewarping()

Aspose.OCR for the Java API has been extended with PreprocessingFilter.AutoDewarping() image preprocessing method that straightens severely curved and distorted images such as photographed pages from books, magazines, and the like. Such images are almost impossible to read by standard recognition algorithms.

Important considerations

  • It is highly recommended to use DetectAreasMode.CURVED_TEXT areas detection mode to extract text from the dewarped image. Other area detection modes may produce inaccurate results.
  • Automatic skew correction must be turned off. Its combination with dewarping may result in severe image distortion.
  • Due to the high complexity of the underlying neural network, dewarping requires significant system resources.

Updated public APIs:

No changes.

Removed public APIs:

No changes.

Usage examples

The examples below illustrates the changes introduced in this release:

Correct geometric distortions

AsposeOCR api = new AsposeOCR();	
RecognitionSettings settings = new RecognitionSettings();
// Apply dewarping filter 
PreprocessingFilter filters = new PreprocessingFilter();
filters.add(PreprocessingFilter.AutoDewarping());
settings.setPreprocessingFilters(filters);
// Save dewarped image to file
BufferedImage image =  api.PreprocessImage(file, filters);
File outputSource = new File("result.png");
ImageIO.write(image, "png", outputSource);
// Extract text from image
RecognitionResult result = api.RecognizePage(file, settings);
System.out.println(result);