Detect and extract text from document images using Amazon Textract. Load an image, run text detection, then click on detected blocks to highlight them on the original image with polygon outlines.
TTextractClient.DetectDocumentTextto detect text in document imagesTTextractDocument.FromFileto load images directly from diskITextractBlockresponse data: text content, block types, and geometry- Using
ITextractBlock.Geometry.Polygonto draw outlines on a bitmap
Client := TTextractClient.Create;
LRequest := TTextractDetectDocumentTextRequest.Create;
LRequest.Document := TTextractDocument.FromFile('document.png');
LResponse := Client.DetectDocumentText(LRequest);
if LResponse.IsSuccessful then
for var LBlock in LResponse.Blocks do
WriteLn(Format('%s: %s', [LBlock.BlockType, LBlock.Text]));- Open "TextractDemo.dproj" in Delphi or RAD Studio.
- Select "Run > Run" from the menu or press F9.
- Click the "Open..." button and choose an image file containing text.
- Click "Detect Document Text".
- Once the list of detected items is populated on the left, you can select an item to highlight on the image.
textract:DetectDocumentText
