ImageEn, unit iexGoogleApi




property WebDetection: TIEGWebDetection;


Returns the result array for Web Entities and Pages (from a iegrWebDetection request).
WEB_DETECTION detects references and related web information for an image, including:
 Best guess label: A best guess as to the topic of the requested image inferred from similar images on the Internet
 Inferred entities (labels/descriptions) from similar images on the Web
 Full matching images: A list of URLs for fully matching images of any size on the Internet
 Partial matching images: A list of URLs for images that share key-point features, such as a cropped version of the original image
 Pages with matching images: A list of Webpages with an image that matches one of the above rules
 Visually similar images: A list of URLs for images that share some features with the original image


More Information:


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

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


  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
    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 ));

  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 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 an VIOLENT image' );

  Cursor := crDefault;
  lblSubmitting.Visible := False;