0

I want to get a color palette of an RGB image in order to draw the histograms of distribution of each color this is the the Matlab histogram of a grayscale image

i I separated the RGB values of the image but i get stuck how to get the color palette

def separ(obj):
    import numpy as np 
    data=np.asarray(obj)
    #print(data)#v
    b, g, r = data[:, :, 0], data[:, :, 1], data[:, :, 2] # tuple RGB np tab image
    return b,g,r
  • RGB images use three numbers per pixel to define a color and do not have any palette. Palette images are also known as indexed color and use color tables or color maps to define a color by a single value. So you either need to convert your image to an indexed one, or you can make three histograms for each channel. – Ondro Nov 13 '22 at 11:47

0 Answers0