TIEVisionNNet.detectTexts
 
Declaration
function detectTexts(model: int32_t; image: TIEVisionImage; out confidences: TIEVisionVectorDouble; out detections: TIEVisionVectorRotatedRect): bool32; safecall;
Description
Detects text in the specified input image and returns the text values, confidences and bounding boxes.
Returns True on success (both input and model valid).
 | Parameter |  Description |  
 |  model  |   Model type. 0 = EAST, 1 = DB  |  
 |  image  |   Input image  |  
 |  confidences  |   Output array of confidences per text block detected  |  
 |  detections  |   Output array rotated rectangles per text block detected  |  
 
Note: This method only detects the location of text. To "Recognize" the text, use 
OCR
// Detect all text blocks inside TImageEnView using DB_IC15_resnet18.onnx pretrained model
var
  nnet: TIEVisionNNet;
  rrects: TIEVisionVectorRotatedRect;
  confidences: TIEVisionVectorDouble;
  i: integer;
  r: TIEVisionRect;
begin
  OCR := IEVisionLib.createOCR(IEOCRLanguageList[OCR_English_language].Code);
  nnet := IEVisionLib.createNNet('models\DB\DB_IC15_resnet18.onnx');
  nnet.setInputSize(1280, 736);
  nnet.setInputScale(1.0/255);
  nnet.detectTexts(1, ImageEnView1.IEBitmap.GetIEVisionImage(), confidences, rrects);
  for i := 0 to rrects.size() - 1 do
  begin
    r := IEVisionRect( rrects.getRect(i) );
    // Note: With the East model in can be useful to inflate the text boxes to improve detection
    s := OCR.recognize( ImageEnView1.IEBitmap.GetIEVisionImage(), r ).c_str();
    Memo1.Lines.Add( s );
  end;
end;
