Hi, I am using MATLAB R2020a on a MacOS. I am currently coding a task that involves a change in brightness of 3 simultaneously presented ‘spots’ on the screen whereby I can specify the brightness of the stimuli based on input from a Gaussian distribution. That is, a number is drawn from a Guassian distribution and a particular stimulus brightness is presented based on that. However, I am yet to find any functions/ code that can do this. Any help would be greatly appreciated
From your question, I suggest you start with some tutorials to learn
the basic of PTB, then you’ll see how to draw stimuli at different RGB
values, to create different brightnesses. Peter Scarfe’s tutorials are
probably a good start
Hi, thank you for your suggestion. I have referred to Peter Scarfe’s tutorials before and coded a whole experiment with them. While I understand how to specify different RGB values to generate different coloured stimuli, I am yet to find anything that can alter brightness via a graded scale. Is there any tutorial in particular that illustrates this?
Brightness is a subjective value, and therefore you need to use some sort of psychophysical measurement to guide what physical RGB values you need. If you look at papers that study “Brightness” they often use simultaneous contrast, where the brightness of a patch of consistent luminance (e.g. 20cd/m²) is varied using a surround of varying luminances (e.g. papers by Paradiso or Shapley and colleagues as an example).
You should have linearised your monitor first using a [spectro]photometer so you should have your minimum and maximum luminance for each of your three colour channels, you can use this to work out what the physical luminance is for any value, and then it really depends what you are trying to achieve by varying “brightness”.
Hi, thank you for your suggestion. Apoplogies, but I think I worded my questio incorrectly. What I meant was that I would like to vary the grayscale in a graded manner to produce images of different grayscale values which are easily distinguishable from one another. For instance, is there a way of doing this using colour vector values? Thanks
You first need to ensure that you have used a photometer to linearise your display, and also that your display is using a normal whitepoint and color setting (i.e. standard monitor calibration). A simple linearisation only linearises from [0 0 0]RGB to [1 1 1]RGB, but you may also want to separately linearise the R, G and B channels. You must do this, otherwise the gamma curve of your display will distort the values you add or subtract to make lighter or darker stimuli.
Use PsychDefaultSetup(2) at the start of your script, so that you operate in a 0 - 1 floating point RGB mode. You may see legacy code using integer 0 - 255 which assumes an 8-bit display, but it is not recommended to use this as any internal computations that PTB performs will be limited.
Grey is defined as equal values for R, G and B. so in PTB if you want to make a mid-grey square you specify this as [0.5 0.5 0.5]. To make it “brighter” add the same amount to R, G, & B, i.e. [0.6 0.6 0.6].