PHP Class Google\Cloud\Vision\Annotation\SafeSearch

Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $vision = $cloud->vision(); $imageResource = fopen(__DIR__ .'/assets/family-photo.jpg', 'r'); $image = $vision->image($imageResource, [ 'safeSearch' ]); $annotation = $vision->annotate($image); $safeSearch = $annotation->safeSearch();
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 a SafeSearch annotation result
isAdult ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the image contains adult content.
isMedical ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the image contains medical content
isSpoof ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the image was modified to make it appear funny or offensive.
isViolent ( string $strength = self::STRENGTH_LOW ) : boolean Check whether the image contains violent content

Method Details

__construct() public method

This class is instantiated internally and is used to represent the result of Cloud Vision's SafeSearch annotation feature. It should not be instantiated directly. For complete usage instructions, please refer to {@see \Google\Cloud\Vision\Annotation::safeSearch()}.
public __construct ( array $info )
$info array The SafeSearch annotation result

isAdult() public method

Example: if ($safeSearch->isAdult()) { echo "Image contains adult content."; }
public isAdult ( 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

isMedical() public method

Example: if ($safeSearch->medical()) { echo "Image contains medical content."; }
public isMedical ( 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

isSpoof() public method

Example: if ($safeSearch->isSpoof()) { echo "Image contains spoofed content."; }
public isSpoof ( 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

isViolent() public method

Example: if ($safeSearch->isViolent()) { echo "Image contains violent content."; }
public isViolent ( 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