Vision Face#
Face#
Face class representing the Vision API’s face detection response.
-
class
google.cloud.vision.face.Angles(roll, pan, tilt)[source]# Bases:
objectAngles representing the positions of a face.
-
class
google.cloud.vision.face.Bounds(vertices)[source]# Bases:
google.cloud.vision.geometry.BoundsBaseThe bounding polygon of the entire face.
-
class
google.cloud.vision.face.Emotions(joy_likelihood, sorrow_likelihood, surprise_likelihood, anger_likelihood)[source]# Bases:
objectEmotions 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: EmotionsReturns: 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.BoundsBaseThe 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:
objectRepresentation of a face found by the Vision API
-
angles# Accessor to the pan, tilt and roll angles of a Face.
Return type: AnglesReturns: Pan, tilt and roll angles of the detected face.
-
bounds# Accessor to the bounding poly information of the detected face.
Return type: BoundsReturns: An instance of Boundswhich 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: EmotionsReturns: An instance of Emotionswith joy, sorrow, anger, surprise likelihood.
-
fd_bounds# Accessor to the skin area bounding poly of the detected face.
Return type: FDBoundsReturns: An instance of FDBoundswhich 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: FaceReturns: A instance of Face with data parsed from response.
-
headwear_likelihood# Headwear likelihood.
Return type: LikelihoodReturns: String representing the likelihood based on Likelihood
-
image_properties# Image properties from imaged used in face detection.
Return type: FaceImagePropertiesReturns: FaceImagePropertiesobject with image properties.
-
-
class
google.cloud.vision.face.FaceImageProperties(blurred_likelihood, underexposed_likelihood)[source]# Bases:
objectA 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: FaceImagePropertiesReturns: Instance populated with image property data.
-
-
class
google.cloud.vision.face.FaceLandmarkTypes[source]# Bases:
objectA 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:
objectA 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: LandmarkReturns: 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: PositionReturns: Instance of Position with landmark coordinates.
-
classmethod