(image, bits_per_channel=None)
return unpack_rgb(packed_mode)
Obtains the background color from an image or array of RGB colors
by grouping similar colors into bins and finding the most frequent
one.
Obtains the background color from an image or array of RGB colors
by grouping similar colors into bins and finding the most frequent
one.
Obtains the background color from an image or array of RGB colors by grouping similar colors into bins and finding the most frequent one .
def get_bg_color(image, bits_per_channel=None):
    '''Obtains the background color from an image or array of RGB colors
by grouping similar colors into bins and finding the most frequent
one.

    '''

    assert image.shape[-1] == 3

    quantized = quantize(image, bits_per_channel).astype(int)
    packed = pack_rgb(quantized)

    unique, counts = np.unique(packed, return_counts=True)

    packed_mode = unique[counts.argmax()]

    return unpack_rgb(packed_mode)
def get_bg_color ( image , bits_per_channel = None ) : assert image . shape [ - 1 ] == 3 quantized = quantize ( image , bits_per_channel ) . astype ( int ) packed = pack_rgb ( quantized ) unique , counts = np . unique ( packed , return_counts = True ) packed_mode = unique [ counts . argmax ( ) ] return unpack_rgb ( packed_mode )