How can I implement colors in MATLAB xyY ?

2 views (last 30 days)
matpsyc
matpsyc on 3 Apr 2017
Reopened: Walter Roberson on 22 Dec 2018
I have written a code for a color-naming task in which participants will be randomly presented a set of 12 stimuli and will be asked to report whether the stimulus is green or blue. I display colored squares for this purpose by using the Screen command. I wanted to ask whether it is possible to directly implement colours in xyY colour without converting to RGB.
Thanks in advance.

Accepted Answer

Walter Roberson
Walter Roberson on 3 Apr 2017
"I wanted to ask whether it is possible to directly implement colours in xyY colour without converting to RGB."
No, it is not. MATLAB just sends pixel data to the graphics libraries; it does not have any control over how those pixels are converted into light.
xyY is a model of how humans would perceive theoretical light; it does not deal how to generate light from a real system such that the light actually generated matches the desired properties.
If you are working with perception models to that degree then you should be using calibrated displays and setting up hardware profiles to meet your targets. That might call, for example, for using one of the Eizo self-calibrating displays
  3 Comments
Walter Roberson
Walter Roberson on 3 Apr 2017
Your question is really more one about Psychtoolbox as Screen() is part of that rather than part of MATLAB . Screen() with 'fillrect' only takes rgb or rgba; see http://docs.psychtoolbox.org/FillRect
You might want to look at RenderDemo which puts up an xyY patch.
Stephen23
Stephen23 on 3 Apr 2017
Of course you could use MATLAB to specify the xyY values that you want to display, even if you have to write the toolbox yourself. It is not very likely that you will find any monitor or TV that accepts xyY input though, so you will have to anyway convert to sRGB, or YCbCr, or some other supported color encoding.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!