[ ][ ][ ]]dtype=uint this image pixel matrix is two-dimensional matrix so you can extract features from this further or even flatten it to one-dimensional vector to use as inputs for any machine learning algorithm grayscale image pixels if you are dealing with color imagesit might get difficult working with multiple channels and three-dimensional arrays hence converting images to grayscale is nice way of keeping the necessary pixel intensity values but getting an easy to process two-dimensional image grayscale images usually capture the luminance or intensity of each pixel such that each pixel value can be computed using the equation where rg are the pixel values of the three channels and captures the final pixel intensity information and is usually ranges from (complete intensity absence blackto (complete intensity presence whitethe following snippet shows us how to convert rgb color images to grayscale and extract the raw pixel valueswhich can be used as features in [ ]from skimage color import rgb gray cgs rgb gray(catdgs rgb gray(dogprint('image shape:'cgs shape'\ ' pixel map print(' image pixel map'print(np round(cgs )'\ 'flattened pixel feature vector print('flattened pixel map:'(np round(cgs flatten() ))image shape( image pixel map [ ]flattened pixel map binning image intensity distribution we already obtained the raw image intensity values for the grayscale images in the previous section one approach would be to use these raw pixel values themselves as features another approach would be to binning the image intensity distribution based on intensity values using histogram and using the bins as features the following code snippet shows us how the image intensity distribution looks for the two sample images