Read Photo
This code example demonstrates how to use the IronTesseract OCR engine to extract text and analyze specific regions from a photo.
An instance of the IronTesseract OCR engine is created. An OcrInput object is initialized, and an image frame ("ocr.tiff") is loaded using the LoadImageFrame method. The 0 indicates that the first frame of the image is being processed. The OCR engine reads the photo using the ReadPhoto method, which returns an OcrPhotoResult object containing the OCR results, including recognized text and regions. The first region of the recognized text is identified: The FrameNumber of the region is stored in the number variable. The TextInRegion property retrieves the text found in the first region. The coordinates of the text region (bounding box) are stored in the region variable, using the Region property. The output is formatted into a readable string, including: The text in the first region (textinregion). The coordinates and dimensions of the text region (X, Y, Width, Height). The OCR confidence score (result.Confidence). The full text from the scanned photo (result.Text). The output string is then printed to the console, providing detailed information about the first recognized region and the overall OCR result. This approach allows for granular analysis of text regions within an image and can be useful for extracting information from structured documents or photos with distinct regions.