| Reference | Downloads | Github

Is it possible to access the window pixel data (gun values) as an array?

Hi all,

I’m using alpha-layering in Psychopy to draw some moderately complicated patterns. I’m interested in verifying that things are working the way I expect them to with more precision than just by looking at the resulting patterns. Is there any function to return the array of pixel values that PsychoPy is actually drawing? In other words, if I have a [800 x 600] window called win, I would expect win.getArray() to return a [800 x 600 x 3] array of values in 0-255. Does this function or something like it exist, either in PsychoPy or by reaching into the Pyglet/OpenGL backend?


I think the following should give you such an array:
img_array = np.array(win.getMovieFrame())

1 Like

Indeed I think that does the trick, thanks!