Example 1: Reading text from an Image
Step 1: Install and load the libraries:
R
install.packages ( 'tesseract' ) install.packages ( 'magick' ) library (tesseract) library (magick) |
Step 2: Load an image from a URL or file storage.
R
# Reading the image img = image_read ( 'https://media.w3wiki.org/wp-content/uploads/20190328185307/gfg28.png' ) # Display print (img) |
Output:
Step 3: Apply the OCR method on it.
R
# OCR text <- ocr (img) # extracted text print (text) |
Output:
[1] "w3wiki\nA computer science portal for geeks\n"
Optical Character Recognition (Ocr) Using R
OCR transforms text images into machine-readable formats. With applications ranging from receipts to license plates, we explore the process, syntax, and examples, demonstrating its versatility. In this tutorial, we will learn to perform Optical Character Recognition in R programming language using the Tesseract and Magick libraries.
Contact Us