Last active
January 10, 2025 13:59
Convert Handwriting to Text using Python. For more details: https://kb.aspose.com/ocr/python/convert-handwriting-to-text-using-python/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.ocr as api # Import the Aspose.OCR module | |
from aspose.ocr import License # Import the License class from the module | |
license = License() # Instantiate and apply a license | |
license.set_license("License.lic") # Load the license file | |
extractTextFromImage = api.AsposeOcr() # Create OCR engine | |
imageDatas = api.OcrInput(api.InputType.SINGLE_IMAGE) # Initialize an input container | |
imageDatas.add("sample2.png")# Add the image file | |
# Perform handwritten text recognition on the provided image | |
textExtractedFromImage = extractTextFromImage.recognize_handwritten_text(imageDatas) | |
length = textExtractedFromImage.length # Get the total number | |
# Iterate through all recognized text segments | |
for i in range(length): | |
# Print each recognized text segment to the console | |
print(textExtractedFromImage[i].recognition_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment