Yoav Arieh wrote:
For CRTs relationship between the RGB value and the display luminance is not linear
though. That is, [100 100 100] does not have twice the luminance of [50 50 50]. The
function which relates the RGB values to luminance is called the monitor's gamma
function. It is different for each of the three guns, R,G&B.
It is possible to generate linear luminance steps on the display by
-incrementing the value of each gun alone and metering luminance at each step.
-using the resulting table to infer what R,G, and B values are needed to generate a
specified luminance.
For lots of useful information on the subject on the subject of monitor calibration,
see:
http://color.psych.ucsb.edu/brainard/characterize.pdf
http://www.psychtoolbox.org/measure.html#references
http://vision.nyu.edu/Tips/HowTo.html#Calibrate
graphics.
In palletized mode, each pixel on the screen is an unsigned 8-bit value (therefore
ranging between 0 and 255 in value). Separately, there is a table called the CLUT
which has 256 entries. Each entry in the CLUT holds three numbers, an R, G, and a B
value. The table might look like this, for example.
Index R G B
0 0 0 0
1 255 0 0
2 0 255 0
3 0 0 255
4 128 128 128
.....
255 255 0 255
The important thing to know is that THE PIXEL VALUE DESIGNATES A ROW IN THE TABLE. Or
in others words, pixels values do not specify luminance values directly, instead they
are pointers to locations which hold RGB luminance values.
For example, if you set a pixel to value 4, with the example CLUT above loaded, then
the luminance of the pixel would be 128 Red, 128 Green, and 128 Blue. If you were to
change the index 4 CLUT entry to 0 0 0, then that pixel would switch to black. If
other pixels had values 1, then their appearance would be unchanged by your
adjustments of CLUT index 4 values. That's because these other pixels point to the
CLUT entry 1, which has a value of 255 R, 0G, and 0B, and they all look red.
One source of bugs when using the psychtoolbox is that Matlab matrices are indexed
beginning with 1, however pixel values are numbered starting with 0. So a pixel set
to 0 points to the CLUT entry indexed with 1, the pixel value of 1 points to the CLUT
entry 2, etc; The CLUT index corresponding to a given pixel value is that pixel value
+ 1.
Best,
Allen
PS. I'm copying this to the forum in case it is of any benefit to others.
>Yes, that's it.
> To my understanding in at 8 bit mode each pixel is defined by
> three color Red, Green and Blue. So, if I pass the numbers [50 50 50] or [100 100
> 100] into the video card I will get the same color both times (gray) but with
> different intensity (or psychologically - different brightness) the latter
> brighter than the former. Is that correct?
For CRTs relationship between the RGB value and the display luminance is not linear
though. That is, [100 100 100] does not have twice the luminance of [50 50 50]. The
function which relates the RGB values to luminance is called the monitor's gamma
function. It is different for each of the three guns, R,G&B.
It is possible to generate linear luminance steps on the display by
-incrementing the value of each gun alone and metering luminance at each step.
-using the resulting table to infer what R,G, and B values are needed to generate a
specified luminance.
For lots of useful information on the subject on the subject of monitor calibration,
see:
http://color.psych.ucsb.edu/brainard/characterize.pdf
http://www.psychtoolbox.org/measure.html#references
http://vision.nyu.edu/Tips/HowTo.html#Calibrate
> If so, for my current project,Here's a brief explanation of CLUTs. Everyone asks about this when they start doing
> presenting shapes with the same color but with different brightness, that's seems
> to be enough. For more sophisticated application I might need a deeper
> understanding of the CLUT and the way you can control it. For instance, in the
> demo, when you changed the CLUT by SetClut command inside the loops, why it
> effected only the shapes and lines and not the background and text?
graphics.
In palletized mode, each pixel on the screen is an unsigned 8-bit value (therefore
ranging between 0 and 255 in value). Separately, there is a table called the CLUT
which has 256 entries. Each entry in the CLUT holds three numbers, an R, G, and a B
value. The table might look like this, for example.
Index R G B
0 0 0 0
1 255 0 0
2 0 255 0
3 0 0 255
4 128 128 128
.....
255 255 0 255
The important thing to know is that THE PIXEL VALUE DESIGNATES A ROW IN THE TABLE. Or
in others words, pixels values do not specify luminance values directly, instead they
are pointers to locations which hold RGB luminance values.
For example, if you set a pixel to value 4, with the example CLUT above loaded, then
the luminance of the pixel would be 128 Red, 128 Green, and 128 Blue. If you were to
change the index 4 CLUT entry to 0 0 0, then that pixel would switch to black. If
other pixels had values 1, then their appearance would be unchanged by your
adjustments of CLUT index 4 values. That's because these other pixels point to the
CLUT entry 1, which has a value of 255 R, 0G, and 0B, and they all look red.
One source of bugs when using the psychtoolbox is that Matlab matrices are indexed
beginning with 1, however pixel values are numbered starting with 0. So a pixel set
to 0 points to the CLUT entry indexed with 1, the pixel value of 1 points to the CLUT
entry 2, etc; The CLUT index corresponding to a given pixel value is that pixel value
+ 1.
Best,
Allen
PS. I'm copying this to the forum in case it is of any benefit to others.