image_transformer.pixels_processors package

Submodules

image_transformer.pixels_processors.average_pixels_processor module

This module contains the AveragePixelsProcessor class which is used to calculate the average RGB color from a given set of pixels.

class image_transformer.pixels_processors.average_pixels_processor.AveragePixelsProcessor[source]

Bases: GenericPixelsProcessor

A class used to process pixels and calculate the average RGB color.

get_rgb_color_from_pixels(pixels: ndarray) Tuple[int, int, int][source]

Calculates the average RGB color from the given pixels.

Parameters:

pixels (np.ndarray) – A numpy array of pixels from which the average color is to be calculated.

Returns:

Tuple[int, int, int]

A tuple representing the average RGB color.

image_transformer.pixels_processors.generic_pixels_processor module

This module contains the definition of the GenericPixelsProcessor abstract base class, which provides an interface for processing pixel data to extract RGB color information.

class image_transformer.pixels_processors.generic_pixels_processor.GenericPixelsProcessor[source]

Bases: ABC

An abstract base class for processing pixel data to extract RGB color information.

abstract get_rgb_color_from_pixels(pixels: ndarray) Tuple[int, int, int][source]

Extracts the RGB color from the given pixel data.

Parameters:

pixels (np.ndarray) – A numpy array representing the pixel data.

Returns:

A tuple containing the RGB color values.

Return type:

Tuple[int, int, int]

image_transformer.pixels_processors.most_frequent_pixels_processor module

This module contains the MostFrequentPixelsProcessor class, which is used to process an array of pixels and determine the most frequently occurring RGB color.

class image_transformer.pixels_processors.most_frequent_pixels_processor.MostFrequentPixelsProcessor[source]

Bases: GenericPixelsProcessor

A processor that identifies the most frequent RGB color from a given array of pixels.

get_rgb_color_from_pixels(pixels: ndarray) Tuple[int, int, int][source]

Determines the most frequent RGB color from the provided array of pixels.

Parameters:

pixels (np.ndarray) – A numpy array of pixels where each pixel is represented as an array of RGB values.

Returns:

The most frequently occurring RGB color as a tuple.

Return type:

Tuple[int, int, int]

image_transformer.pixels_processors.random_pixels_processor module

This module contains the RandomPixelsProcessor class, which is used to generate random RGB colors from pixel data.

class image_transformer.pixels_processors.random_pixels_processor.RandomPixelsProcessor[source]

Bases: GenericPixelsProcessor

A processor that generates random RGB colors from pixel data.

get_rgb_color_from_pixels(pixels: ndarray) Tuple[int, int, int][source]

Generate a random RGB color.

Parameters:

pixels (np.ndarray) – The pixel data from which to generate the color.

Returns:

A tuple representing the RGB color.

Return type:

Tuple[int, int, int]

Module contents

This module initializes the pixels_processors package by importing all functions and classes from the pixels_processors module.