Hello!
I am working on a function that can take an image, shuffle the pixels, and create a new image. It’s mostly good, but for some reason the color is a bit off. These images are just black/white, but when I shuffle the pixels and stitch them back together, the images become either black/grey or grey/white. Would anyone have any suggestions? Code is below.
# image to pixels
im = Image.open('im1.png')
im.convert('L')
pixels = np.array(im, dtype = np.uint8)
# splitting pixels into groups
split_pixels = np.array_split(pixels, 15)
# shuffling pixel groups
shuffled_pixels = random.sample(split_pixels, k = len(split_pixels))
# stitching groups back together
stitched_pixels = np.concatenate(shuffled_pixels)
print(stitched_pixels)
# pixels to image
newIm = visual.ImageStim(win, image = stitched_pixels, colorSpace = 'LMS', size = (6, 6), interpolate = False)
newIm.draw(); win.flip()
Thank you!