Vision Face#
Face#
Face class representing the Vision API’s face detection response.
-
class
google.cloud.vision.face.
Angles
(roll, pan, tilt)[source]# Bases:
object
Angles representing the positions of a face.
-
class
google.cloud.vision.face.
Bounds
(vertices)[source]# Bases:
google.cloud.vision.geometry.BoundsBase
The bounding polygon of the entire face.
-
class
google.cloud.vision.face.
Emotions
(joy_likelihood, sorrow_likelihood, surprise_likelihood, anger_likelihood)[source]# Bases:
object
Emotions displayed by the face detected in an image.
-
anger_likelihood
# Likelihood of anger in detected face.
Return type: str Returns: String derived from Likelihood
.
-
classmethod
from_api_repr
(response)[source]# Factory: construct Emotions from Vision API response.
Parameters: response (dict) – Response dictionary representing a face. Return type: Emotions
Returns: Populated instance of Emotions.
-
joy_likelihood
# Likelihood of joy in detected face.
Return type: str Returns: String derived from Likelihood
.
-
-
class
google.cloud.vision.face.
FDBounds
(vertices)[source]# Bases:
google.cloud.vision.geometry.BoundsBase
The bounding polygon of just the skin portion of the face.
-
class
google.cloud.vision.face.
Face
(angles, bounds, detection_confidence, emotions, fd_bounds, headwear_likelihood, image_properties, landmarks, landmarking_confidence)[source]# Bases:
object
Representation of a face found by the Vision API
-
angles
# Accessor to the pan, tilt and roll angles of a Face.
Return type: Angles
Returns: Pan, tilt and roll angles of the detected face.
-
bounds
# Accessor to the bounding poly information of the detected face.
Return type: Bounds
Returns: An instance of Bounds
which has a list of vertices.
-
detection_confidence
# Face detection confidence score determined by the Vision API.
Return type: float Returns: Float representation of confidence ranging from 0 to 1.
-
emotions
# Accessor to the possible emotions expressed in the detected face.
Return type: Emotions
Returns: An instance of Emotions
with joy, sorrow, anger, surprise likelihood.
-
fd_bounds
# Accessor to the skin area bounding poly of the detected face.
Return type: FDBounds
Returns: An instance of FDBounds
which has a list of vertices.
-
classmethod
from_api_repr
(response)[source]# Factory: construct an instance of a Face from an API response
Parameters: response (dict) – Face annotation dict returned from the Vision API. Return type: Face
Returns: A instance of Face with data parsed from response.
-
headwear_likelihood
# Headwear likelihood.
Return type: Likelihood
Returns: String representing the likelihood based on Likelihood
-
image_properties
# Image properties from imaged used in face detection.
Return type: FaceImageProperties
Returns: FaceImageProperties
object with image properties.
-
-
class
google.cloud.vision.face.
FaceImageProperties
(blurred_likelihood, underexposed_likelihood)[source]# Bases:
object
A representation of the image properties from face detection.
-
blurred_likelihood
# Likelihood of the image being blurred.
Return type: str Returns: String representation derived from Position
.
-
classmethod
from_api_repr
(response)[source]# Factory: construct image properties from image.
Return type: FaceImageProperties
Returns: Instance populated with image property data.
-
-
class
google.cloud.vision.face.
FaceLandmarkTypes
[source]# Bases:
object
A representation of the face detection landmark types.
See: https://cloud.google.com/vision/reference/rest/v1/images/annotate#Type_1
-
CHIN_GNATHION
= 'CHIN_GNATHION'#
-
CHIN_LEFT_GONION
= 'CHIN_LEFT_GONION'#
-
CHIN_RIGHT_GONION
= 'CHIN_RIGHT_GONION'#
-
FOREHEAD_GLABELLA
= 'FOREHEAD_GLABELLA'#
-
LEFT_EAR_TRAGION
= 'LEFT_EAR_TRAGION'#
-
LEFT_EYE
= 'LEFT_EYE'#
-
LEFT_EYEBROW_UPPER_MIDPOINT
= 'LEFT_EYEBROW_UPPER_MIDPOINT'#
-
LEFT_EYE_BOTTOM_BOUNDARY
= 'LEFT_EYE_BOTTOM_BOUNDARY'#
-
LEFT_EYE_LEFT_CORNER
= 'LEFT_EYE_LEFT_CORNER'#
-
LEFT_EYE_PUPIL
= 'LEFT_EYE_PUPIL'#
-
LEFT_EYE_RIGHT_CORNER
= 'LEFT_EYE_RIGHT_CORNER'#
-
LEFT_EYE_TOP_BOUNDARY
= 'LEFT_EYE_TOP_BOUNDARY'#
-
LEFT_OF_LEFT_EYEBROW
= 'LEFT_OF_LEFT_EYEBROW'#
-
LEFT_OF_RIGHT_EYEBROW
= 'LEFT_OF_RIGHT_EYEBROW'#
-
LOWER_LIP
= 'LOWER_LIP'#
-
MIDPOINT_BETWEEN_EYES
= 'MIDPOINT_BETWEEN_EYES'#
-
MOUTH_CENTER
= 'MOUTH_CENTER'#
-
MOUTH_LEFT
= 'MOUTH_LEFT'#
-
MOUTH_RIGHT
= 'MOUTH_RIGHT'#
-
NOSE_BOTTOM_CENTER
= 'NOSE_BOTTOM_CENTER'#
-
NOSE_BOTTOM_LEFT
= 'NOSE_BOTTOM_LEFT'#
-
NOSE_BOTTOM_RIGHT
= 'NOSE_BOTTOM_RIGHT'#
-
NOSE_TIP
= 'NOSE_TIP'#
-
RIGHT_EAR_TRAGION
= 'RIGHT_EAR_TRAGION'#
-
RIGHT_EYE
= 'RIGHT_EYE'#
-
RIGHT_EYEBROW_UPPER_MIDPOINT
= 'RIGHT_EYEBROW_UPPER_MIDPOINT'#
-
RIGHT_EYE_BOTTOM_BOUNDARY
= 'RIGHT_EYE_BOTTOM_BOUNDARY'#
-
RIGHT_EYE_LEFT_CORNER
= 'RIGHT_EYE_LEFT_CORNER'#
-
RIGHT_EYE_PUPIL
= 'RIGHT_EYE_PUPIL'#
-
RIGHT_EYE_RIGHT_CORNER
= 'RIGHT_EYE_RIGHT_CORNER'#
-
RIGHT_EYE_TOP_BOUNDARY
= 'RIGHT_EYE_TOP_BOUNDARY'#
-
RIGHT_OF_LEFT_EYEBROW
= 'RIGHT_OF_LEFT_EYEBROW'#
-
RIGHT_OF_RIGHT_EYEBROW
= 'RIGHT_OF_RIGHT_EYEBROW'#
-
UNKNOWN_LANDMARK
= 'UNKNOWN_LANDMARK'#
-
UPPER_LIP
= 'UPPER_LIP'#
-
-
class
google.cloud.vision.face.
Landmark
(position, landmark_type)[source]# Bases:
object
A face-specific landmark (for example, a face feature, left eye).
-
classmethod
from_api_repr
(response_landmark)[source]# Factory: construct an instance of a Landmark from a response.
Parameters: response_landmark (dict) – Landmark representation from Vision API. Return type: Landmark
Returns: Populated instance of Landmark.
-
landmark_type
# Landmark type of facial feature.
Return type: str Returns: String representation of facial landmark type.
-
position
# Landmark position on face.
Return type: Position
Returns: Instance of Position with landmark coordinates.
-
classmethod