I am using pygame to show grayscale images. However, it can't show grayscale image, the output is here
The images are numpy arrays of which shape is 80X80, and the code is here
surf_1 = pygame.surfarray.make_surface(pic_1)
surf_2 = pygame.surfarray.make_surface(pic_2)
surf_3 = pygame.surfarray.make_surface(pic_3)
surf_4 = pygame.surfarray.make_surface(pic_4)
self.screen.blit(surf_1, (120, 40))
self.screen.blit(surf_2, (210, 40))
self.screen.blit(surf_3, (300, 40))
self.screen.blit(surf_4, (390, 40))
My question is how can I show real grayscale images instead of the blue-green one.
Update
Here is the code to convert RGB to grayscale, it is from the Internet, I don't know the exact source, sorry about that.
def rgb2gray(rgb, img_shape):
gray = np.dot(rgb[..., :3], [0.299, 0.587, 0.114])
return gray.reshape(*img_shape)