Display raw pixel values

Hello,

I’m using MovieStim3(mywin,filename) to to load and play an uncompressed avi, and I’m having some trouble with colors.

I’d like what is sent to my screen to be the raw rgb pixel values from the video file, but there seems to be some additional calibration going on.

I’ve made a set up in the monitor center that has no gamma correction. Is there anywhere else I need to turn calibrations off?

Thanks
Sam

What is the difference between how it looks and how you expect it to look?

For example, a video frame that is a flat grey image of [85,85,85] rgb is displayed as [127,127,127].

Sam

What OS and PsychoPy version are you using? Maybe also try setting gamma=1.0 when opening the window and see if that changes anything. Also, are the gamma values set to 1.0 in the monitor centre?

Windows 8 unfortunately, it’s what was to hand. Psychopy is 1.90.2

It seems to be set up in monitor centre, but forcing gamma to 1 once the window is created seems to do the trick. Thanks very much

Sam

I’ve looked into it a little further. I ran a video that played each 8 bit grey value between 1 and 255 four times.
Certain grey values are rounded down to one below:

Between 32 and 64 it rounds down these greys separated by 4
33, 37, 41, 45, 49, 53, 57, 61

Between 65 and 128 it rounds down these greys separated by 8
66, 74, 82, 90, 98, 106, 114, 122

Above 129 it rounds down these greys separated by 16
132, 148, 164, 180, 196, 212, 228, 244

I’m going to get a clean windows 10 install and see if that helps

Sam

How are you getting those output grey levels?

The display I’m using is a DMD; the grey value is created by breaking the frame up in time into each bit plane. So you can see which bits are on for each frame.

image

Do you see the same thing if you use a Rect rather then a MovieStim3?

So I’ve upgraded to windows 10 but I’m those grayscales are still being displayed at one value lower.
I see the same effect when using rect

I think you would get your pattern of behaviour with improper casting:

print np.argwhere(((np.linspace(0, 1, 256) * 255).astype("uint8") - np.arange(256)) != 0)
array([[ 33],
       [ 37],
       [ 41],
       [ 45],
       [ 49],
       [ 53],
       [ 57],
       [ 61],
       [ 66],
       [ 74],
       [ 82],
       [ 90],
       [ 98],
       [106],
       [114],
       [122],
       [132],
       [148],
       [164],
       [180],
       [196],
       [212],
       [228],
       [244]])

Could you try editing the psychopy file visual/backends/gamma.py, replacing the lines (currently 82-83):

    if sys.platform == 'win32':
        newRamp = (255.0 * newRamp).astype(numpy.uint16)

with:

    if sys.platform == 'win32':
        newRamp = np.round(255.0 * newRamp).astype(numpy.uint16)
1 Like

That’s done the trick!

Thank you very much