CieLAB Annotators

Annotators to extract CIELAB color histograms.

class dvt.annotate.cielab.CIElabAnnotator(**kwargs)[source]

Bases: dvt.abstract.FrameAnnotator

Annotator for constructing a color histogram and extracting the dominant colours for an image in CIELAB colorspace.

The annotator will return a histogram describing the color distribution of an image, and a list of the most dominant colors.

freq

How often to perform the embedding. For example, setting the frequency to 2 will computer every other frame in the batch.

Type:int
num_buckets

A tuple of three numbers giving the maximum number of buckets in each color channel, Lightness, A, B. These should each be a power of 2. Default is (16, 16, 16).

Type:tuple
num_dominant

Number of dominant colors to extract. Default is 5.

Type:int
frames

An optional list of frames to process. This should be a list of integers or a 1D numpy array of integers. If set to something other than None, the freq input is ignored.

Type:array of ints
name

A description of the aggregator. Used as a key in the output data.

Type:str
annotate(batch)[source]

Annotate the batch of frames with the cielab annotator.

Parameters:batch (FrameBatch) – A batch of images to annotate.
Returns:A list of dictionaries containing the video name, frame, the CIELAB histogram of length (num_buckets[0] * num_buckets[1] * num_buckets[2]), and an array of dominant colors of shape (num_dominant, 3).
name = 'cielab'