I would like to append to a list all of the blue pixels of a jpeg image using matplolib's imshow. When I launch my code, I do not get an RGB code result:'array([89, 67, 28], dtype=uint8), array([51, 53, 16], dtype=uint8),' etc... What is going wrong here?
import matplotlib.pyplot as plt import matplotlib.image as mpimg
control = mpimg.imread('jpeg.jpg')
ys = control.shape[0] #length of image
xs = control.shape[1] # image width
pixelcoords= []
for x in range(xs):
for y in range(ys):
# if pixel is blue
pixelcoords.append(control[x][y])
print(pixelcoords)