Vision Image Properties#

Image Properties Annotation#

Image properties class representation derived from Vision API response.

class google.cloud.vision.color.Color(red, green, blue, alpha)[source]#

Bases: object

Representation of RGBA color information.

Parameters:
  • red (int) – The amount of red in the color as a value in the interval [0, 255].
  • green (int) – The amount of green in the color as a value in the interval [0, 255].
  • blue (int) – The amount of blue in the color as a value in the interval [0, 255].
  • alpha (float) – The fraction of this color that should be applied to the pixel.
alpha#

Alpha transparency level.

Return type:float
Returns:Alpha transparency level.
blue#

Blue component of the color.

Return type:int
Returns:Blue RGB value.
classmethod from_api_repr(response)[source]#

Factory: construct a Color from a Vision API response.

Parameters:response (dict) – Color from API Response.
Return type:Color
Returns:Instance of Color.
green#

Green component of the color.

Return type:int
Returns:Green RGB value.
red#

Red component of the color.

Return type:int
Returns:Red RGB value.
class google.cloud.vision.color.ColorInformation(color, score, pixel_fraction)[source]#

Bases: object

Representation of color information from API response.

Parameters:
  • color (Color) – RGB components of the color.
  • score (float) – Image-specific score for this color. Value in range [0, 1].
  • pixel_fraction (float) – Stores the fraction of pixels the color occupies in the image. Value in range [0, 1].
color#

RGB components of the color.

Return type:Color
Returns:Instance of Color.
classmethod from_api_repr(response)[source]#

Factory: construct ColorInformation for a color found.

Parameters:response (dict) – Color data with extra meta information.
Return type:ColorInformation
Returns:Instance of ColorInformation.
pixel_fraction#

Stores the fraction of pixels the color occupies in the image.

Return type:float
Returns:Pixel fraction value in range [0, 1].
score#

Image-specific score for this color. Value in range [0, 1].

Return type:float
Returns:Image score for this color.
class google.cloud.vision.color.ImagePropertiesAnnotation(colors)[source]#

Bases: object

Representation of image properties

Parameters:colors (list) – List of ColorInformation.
colors#

Colors in an image.

Return type:list of ColorInformation
Returns:Populated list of ColorInformation.
classmethod from_api_repr(response)[source]#

Factory: construct ImagePropertiesAnnotation from a response.

Parameters:response (dict) – Dictionary response from Vision API with image properties data.
Return type:ImagePropertiesAnnotation.
Returns:Populated instance of ImagePropertiesAnnotation.