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 (float) – The amount of red in the color as a value in the interval [0.0, 255.0].
  • green (float) – The amount of green in the color as a value in the interval [0.0, 255.0].
  • blue (float) – The amount of blue in the color as a value in the interval [0.0, 255.0].
  • 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.
classmethod from_pb(color)[source]#

Factory: construct a Color from a protobuf response.

Parameters:colorColor 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(color_information)[source]#

Factory: construct ColorInformation for a color.

Parameters:color_information (dict) – Color data with extra meta information.
Return type:ColorInformation
Returns:Instance of ColorInformation.
classmethod from_pb(color_information)[source]#

Factory: construct ColorInformation for a color.

Parameters:color_information (ColorInfo) – 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(image_properties)[source]#

Factory: construct ImagePropertiesAnnotation from a response.

Parameters:image_properties (dict) – Dictionary response from Vision API with image properties data.
Return type:list of ImagePropertiesAnnotation.
Returns:List of ImagePropertiesAnnotation.
classmethod from_pb(image_properties)[source]#

Factory: construct ImagePropertiesAnnotation from a response.

Parameters:image_properties (ImageProperties) – Protobuf response from Vision API with image properties data.
Return type:list of ImagePropertiesAnnotation
Returns:List of ImagePropertiesAnnotation.