Hello All,
Do you have any codes on Color Look Up Table (CLUT)? Would you mind to find why the following codes are running for me? I think that MATLAB codes are running fine but there is a problem on the Psychtoolbox part?
I am trying to build a sinewave gratings/squarewave gratings with hue and contrast change.
If anyone can help me out.
% STEP 1: Creating a sinusoidal image in a MATLAB matrix.
nPixels = 256;
cyclesPerImage = 4;
sinVector = 1+254*(1+ sin(2*pi*cyclesPerImage*(1:nPixels)/nPixels))/2;
sinImage =ones(nPixels,1)*sinVector;
% STEP 2: Create a set of color lookup tables (cluts) for animating the grating.
nCluts = 80;
theCluts=zeros(256,3*nCluts);
theContrasts =sin(2*pi*(0:nCluts-1)/nCluts);
for i = 1:nCluts
contrast = theContrasts(i);
lowVal = 127.5-contrast*127.5;
highVal = 127.5+contrast*127.5;
clutEntries =[round(linspace(lowVal,highVal,256)')];
theCluts(:,(i-1)*3+1:i*3)= clutEntries*ones(1,3);
end
offClut = 128*ones(256,3);
firstClutEntry=0;
framesPerClut=3;
nCycles =2;
% STEP 3: Open up a window on the main screen, initialize the clut, and draw a grating onto the screen.
whichScreen = max(Screen('Screens')); % find the main monitor
[windowPtr, rect] = PsychImaging('OpenWindow',whichScreen);
% Screen('ClutMovie',windowPtr, theCluts, firstClutEntry, framesPerClut, nCluts*nCycles);
Screen('LoadNormalizedGammaTable',windowPtr, theCluts, firstClutEntry, framesPerClut, nCluts*nCycles);
% Screen('LoadCLUT',windowPtr, offClut);
Screen('SetClut', windowPtr,offClut);
Screen('Flip',windowPtr);
Screen('CloseScreen');
It would be great if anyone could help me out this.
Thank you,
Best,
Debarshi Datta