ImageStim and GratingStim do not display an image that is stored as numpy array

I want to display an image RGB image. but the image is not a string of the image directory. it a numpy array with size 256x256x3. I have tried with both ImageStim and GratingStim but it did not work. it just displays the background without the image. I am using the psychopy version ‘2020.1.2’.

I have tried many things: scaled the image between -1 and 1; scaled the image between 0 and 1; scaled between 0 and 255; I have converted the image with a size 3x256x256. All of them gave me the same results. it only shows the background.

import numpy as np
import cv2 as cv
from psychopy import visual as pp_visual

win = pp_visual.Window(
    color=[0, 0, 0],
    colorSpace='rgb',
    units="pix",
    fullscr=False,
    allowGUI=False)

directory_t_pose = 'T_pose.png'
image_t_pose = (cv.imread(directory_t_pose).astype(float) / 255 * 2) - 1
frame_t_pose = pp_visual.ImageStim(win=win, image=image_t_pose)

for t in range(100):
    frame_t_pose.draw()
    win.flip()

Can you explain what that means?

thanks @Michael for your quick reply

I have reworded. I hope it is more clear now.

Can you upload the image file so we can run the script?

here is the image. thanks.

T_pose

I remember it used to work about 1 year ago. So I tried to run it with psychopy 3.2.3 or psychopy 3.2.2, and with pyglet 1.3.3 or 1.3.2. It doesn’t work anyway. It may be an update of another library.

is anyone helping, please?