Hi all!
I am making an experiment where an image is first blurred and then becomes clear with time to see when participants can recognize a certain image.
Because I need to run this experiment on Windows computers, I needed to use the PIL package first to load the images, but now the images appear to be fully red or blue instead of their normal colors. After this I also convert them to OpenCV.
For some clarity here is my code:
file_path = os.path.abspath(‘stimuli - mp/’ + str(expdf.loc[t, ‘VisualStim’]))
try:
image = Image.open(file_path).convert(“RGB”)
except:
print(‘no such file’)
foto = numpy.array(image)
normalized_image = ((foto - foto.min()) * (255 / (foto.max() - foto.min()))).astype('uint8')
foto = normalized_image[:,:,::-1] # Convert from PIL's default RGB to OpenCV's BGR format
#foto = cv2.cvtColor(numpy.array(image), cv2.COLOR_RGB2BGR).astype('uint8') # Convert from PIL's default RGB to OpenCV's BGR format
Does anyone have an idea or had the same problem in the past?
I am lost!!
Thank you,
Laura