ImageEn, unit iexGoogleApi

TIEGEntityAnnotationArray


Declaration

  TIEGEntityAnnotation = record
    mid: string;                        // Opaque entity ID. Some IDs may be available in Google Knowledge Graph Search API.
    locale: string;                     // The language code for the locale in which the entity textual description is expressed.
    description: string;                // Entity textual description, expressed in its locale language.
    score: Double;                      // Overall score of the result. Range [0, 1]
    topicality: Double;                 // The relevancy of the ICA (Image Content Annotation) label to the image. For example, the relevancy of "tower" is likely higher to an image containing the detected "Eiffel Tower" than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1]
    boundingPoly: TRect;                // Image region to which this entity belongs. Not produced for LABEL_DETECTION features
    latitude: Double;                   // The location information for the detected entity. Multiple LocationInfo elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. ImageEn only returns the principal location
    longitude: Double;                  // The location information for the detected entity. Multiple LocationInfo elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks. ImageEn only returns the principal location
    // Unhandled: properties[]          // Some entities may have optional user-supplied Property (name/value) fields, such a score or string that qualifies the entity (Use of this attribute is rarely encoutered)
  end;
  TIEGEntityAnnotationArray = array of TIEGEntityAnnotation;

Description

Results array for Landmark (iegrLandmarkDetection request), Logo (iegrLogoDetection request), Label (iegrLabelDetection request) and Text detection (iegrTextDetection request).

  

  


Example

Cursor := crHourglass;
lblSubmitting.Visible := True;
GVision := TIEGoogleVision.Create( MY_API_KEY );
try
  // Use recommended delivery size (for faster processing)
  GVision.SendImageWidth  := 640;
  GVision.SendImageHeight := 480;

  GVision.RequestTypes := [iegrWebDetection, iegrSafeSearchDetection, iegrLandmarkDetection];
  GVision.ProcessImage( edtFilename.Text );

  lbxResults.Clear();

  if Length( GVision.WebDetection.bestGuessLabels ) > 0 then
    lbxResults.Items.Add( 'This image is likely to be: ' + GVision.WebDetection.bestGuessLabels[0].webLabel );

  if GVision.HasLandmarkAnnotations then
  begin
    lbxResults.Items.Add( 'This image is the landmark: ' + GVision.LandmarkAnnotations[0].description );
    lbxResults.Items.Add( 'Latitude: '  + LatLongToStr( GVision.LandmarkAnnotations[0].latitude, True ));
    lbxResults.Items.Add( 'Longitude: ' + LatLongToStr( GVision.LandmarkAnnotations[0].longitude, False ));
  end;

  lbxResults.Items.Add( format( 'Found %d matching images on the web', [ GVision.WebDetection.fullMatchingImages.Count ]));
  lbxResults.Items.AddStrings( GVision.WebDetection.fullMatchingImages );

  lbxResults.Items.Add( format( 'Found %d pages on the web containing this image', [ GVision.WebDetection.pagesWithMatchingImages.Count ]));
  lbxResults.Items.AddStrings( GVision.WebDetection.pagesWithMatchingImages );

  if GVision.SafeSearchAnnotation.adult in [ieglLikely, ieglVeryLikely] then
    lbxResults.Items.Add( 'Likely to be an ADULT image' );

  if GVision.SafeSearchAnnotation.violence in [ieglLikely, ieglVeryLikely] then
    lbxResults.Items.Add( 'Likely to be a VIOLENT image' );

finally
  Cursor := crDefault;
  lblSubmitting.Visible := False;
  GVision.Free;
end;


See Also

LandmarkAnnotations
LogoAnnotations
LabelAnnotations
TextAnnotations
TextContent