PHP Class Google\Cloud\Vision\Annotation\Face

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); $faces = $annotation->faces(); $face = $faces[0];
See also: https://cloud.google.com/vision/reference/rest/v1/images/annotate#faceannotation FaceAnnotation
Inheritance: extends AbstractFeature, use trait Google\Cloud\CallTrait, use trait LikelihoodTrait
Datei anzeigen Open project: GoogleCloudPlatform/gcloud-php

Public Methods

Method Description
__construct ( array $info ) Create an Face result.
hasHeadwear ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the person is wearing headwear.
isAngry ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the face is angry.
isBlurred ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the face is blurred.
isJoyful ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the face is joyful.
isSorrowful ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the face is sorrowful.
isSurprised ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the face is surprised.
isUnderExposed ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the face is under exposed.
landmarks ( ) : Landmarks Returns an object detailing facial landmarks and their location.

Method Details

__construct() public method

This class is created internally by {@see \Google\Cloud\Vision\Annotation}. See {@see \Google\Cloud\Vision\Annotation::faces()} for full usage details. This class should not be instantiated outside the externally.
public __construct ( array $info )
$info array The face annotation result

hasHeadwear() public method

Example: if ($face->hasHeadwear()) { echo "Face has Headwear"; }
public hasHeadwear ( string $strength = self::STRENGTH_LOW ) : boolean
$strength string [optional] Value should be one of "low", "medium" or "high". Recommended usage is via `Face::STRENGTH_*` constants. Higher strength will result in fewer `true` results, but fewer false positives. **Defaults to** `"low"`.
return boolean

isAngry() public method

Example: if ($face->isAngry()) { echo "Face is Angry"; }
public isAngry ( string $strength = self::STRENGTH_LOW ) : boolean
$strength string [optional] Value should be one of "low", "medium" or "high". Recommended usage is via `Face::STRENGTH_*` constants. Higher strength will result in fewer `true` results, but fewer false positives. **Defaults to** `"low"`.
return boolean

isBlurred() public method

Example: if ($face->isBlurred()) { echo "Face is Blurred"; }
public isBlurred ( string $strength = self::STRENGTH_LOW ) : boolean
$strength string [optional] Value should be one of "low", "medium" or "high". Recommended usage is via `Face::STRENGTH_*` constants. Higher strength will result in fewer `true` results, but fewer false positives. **Defaults to** `"low"`.
return boolean

isJoyful() public method

Example: if ($face->isJoyful()) { echo "Face is Joyful"; }
public isJoyful ( string $strength = self::STRENGTH_LOW ) : boolean
$strength string [optional] Value should be one of "low", "medium" or "high". Recommended usage is via `Face::STRENGTH_*` constants. Higher strength will result in fewer `true` results, but fewer false positives. **Defaults to** `"low"`.
return boolean

isSorrowful() public method

Example: if ($face->isSorrowful()) { echo "Face is Sorrowful"; }
public isSorrowful ( string $strength = self::STRENGTH_LOW ) : boolean
$strength string [optional] Value should be one of "low", "medium" or "high". Recommended usage is via `Face::STRENGTH_*` constants. Higher strength will result in fewer `true` results, but fewer false positives. **Defaults to** `"low"`.
return boolean

isSurprised() public method

Example: if ($face->isSurprised()) { echo "Face is Surprised"; }
public isSurprised ( string $strength = self::STRENGTH_LOW ) : boolean
$strength string [optional] Value should be one of "low", "medium" or "high". Recommended usage is via `Face::STRENGTH_*` constants. Higher strength will result in fewer `true` results, but fewer false positives. **Defaults to** `"low"`.
return boolean

isUnderExposed() public method

Example: if ($face->isUnderExposed()) { echo "Face is Under Exposed"; }
public isUnderExposed ( string $strength = self::STRENGTH_LOW ) : boolean
$strength string [optional] Value should be one of "low", "medium" or "high". Recommended usage is via `Face::STRENGTH_*` constants. Higher strength will result in fewer `true` results, but fewer false positives. **Defaults to** `"low"`.
return boolean

landmarks() public method

Example: $leftEye = $face->landmarks()->leftEye();
public landmarks ( ) : Landmarks
return Google\Cloud\Vision\Annotation\Face\Landmarks