PHP Class Google\Cloud\Vision\Annotation

Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $vision = $cloud->vision(); $imageResource = fopen(__DIR__ .'/assets/family-photo.jpg', 'r'); $image = $vision->image($imageResource, [ 'FACE_DETECTION' ]); $annotation = $vision->annotate($image);
Datei anzeigen Open project: GoogleCloudPlatform/gcloud-php Class Usage Examples

Public Methods

Method Description
__construct ( array $info ) Create an annotation result.
error ( ) : array | null Get error information, if present
faces ( ) : Face[] | null Return an array of faces
imageProperties ( ) : ImageProperties | null Fetch image properties
info ( ) : array | null Return raw annotation response array
labels ( ) : Entity[] | null Return an array of labels
landmarks ( ) : Entity[] | null Return an array of landmarks
logos ( ) : Entity[] | null Return an array of logos
safeSearch ( ) : SafeSearch | null Get the result of a safe search detection
text ( ) : Entity[] | null Return an array containing all text found in the image

Method Details

__construct() public method

This class represents a single image annotation response from Cloud Vision. If multiple images were tested at once, the result will be an array of Annotation instances. This class is not intended to be instantiated outside the Google Cloud Platform Client Library.
public __construct ( array $info )
$info array The annotation result

error() public method

Example: $error = $annotation->error();
See also: https://cloud.google.com/vision/reference/rest/v1/images/annotate#status Status Format
public error ( ) : array | null
return array | null

faces() public method

Example: $faces = $annotation->faces();
public faces ( ) : Face[] | null
return Google\Cloud\Vision\Annotation\Face[] | null

imageProperties() public method

Example: $properties = $annotation->imageProperties();
public imageProperties ( ) : ImageProperties | null
return Google\Cloud\Vision\Annotation\ImageProperties | null

info() public method

Example: $info = $annotation->info();
See also: https://cloud.google.com/vision/reference/rest/v1/images/annotate#annotateimageresponse AnnotateImageResponse
public info ( ) : array | null
return array | null

labels() public method

Example: $labels = $annotation->labels();
public labels ( ) : Entity[] | null
return Google\Cloud\Vision\Annotation\Entity[] | null

landmarks() public method

Example: $landmarks = $annotation->landmarks();
public landmarks ( ) : Entity[] | null
return Google\Cloud\Vision\Annotation\Entity[] | null

logos() public method

Example: $logos = $annotation->logos();
public logos ( ) : Entity[] | null
return Google\Cloud\Vision\Annotation\Entity[] | null

safeSearch() public method

Example: $safeSearch = $annotation->safeSearch();
public safeSearch ( ) : SafeSearch | null
return Google\Cloud\Vision\Annotation\SafeSearch | null

text() public method

Example: $text = $annotation->text();
public text ( ) : Entity[] | null
return Google\Cloud\Vision\Annotation\Entity[] | null