Recognize Text by Performing OCR on Image from URL with Java

Recognize-Text-OCR-Image-using-Java

You can convert a text from the image to an editable format with Optical Character Recognition (OCR). Images like JPG, PNG, TIFF, BMP, GIF, etc. are used everywhere on the internet and you may need to recognize text from an online image. You can easily use the URL link to that image to perform the OCR on it, instead of saving or downloading the file. The following headings discuss the details further:

Java OCR API – Installation

Aspose.OCR for Java API can be used to perform Optical Character Recognition operations on images. It can recognize text and convert the image to editable text. Please download the JAR file of API from the Downloads section or specify the following Maven configurations in pom.xml file of your project:

Repository

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>http://repository.aspose.com/repo/</url>
</repository>

Dependency

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-ocr</artifactId>
    <version>20.5</version>
</dependency>

Recognize Text by Performing OCR on Image from URL with Java

You can perform Optical Character Recognition on an image from URL with the following steps:

  1. Create API instance with AsposeOCR class.
  2. Specify image URI.
  3. Set recognition options with RecognitionSettings class.
  4. Get result object.
  5. Print result.

The following code explains how to recognize text by performing OCR on image from URL programmatically using Java:

Recognize Text from Skewed or Tilted Image with OCR using Java

Sometimes an image can be tilted or skewed for some reason. For instance, an image created by a camera or scanner can be a little skewed, then you can get the skew angle of the input image. You can improve the accuracy of text recognition by knowing and correcting the skew angle. You need to follow the following steps:

  • Create API Instance using AsposeOCR object.
  • Set recognition options.
  • Calculate and set skew angle.
  • Get the result with the RecognitionResult object and print it.

The code below shows how to recognize text from a skewed image with OCR programmatically in Java:

Get Free API License

You can request a Free Temporary License to evaluate the API in its full capacity.

Conclusion

In conclusion, you have learned how to recognize text by performing OCR operations on an image from any URL address. Moreover, you have explored how to correct the skew angle for the image to improve the accuracy and efficiency of the API. You can take a look at several other features of the API by visiting the Documentation, or please feel free to contact us via Free Support Forum in case of any queries.

See Also