Dear all,
I have to create chromatic red-green sinusoidal gratings at a
constant mean luminance (sum of the mean luminances of red and green
gratings).
The chromatic contrast patterns (red-green) were obtained by
superimposing out-of-phase by 180 degrees red-black and green-black
gratings of identical contrast. The ratio of red to total luminance
could be varied from 0 to 1 and this occurs at a constant Michelson
contrast both for green and red gratings.
I created the stimuli in the HSV space (for both colors I kept hue
and saturation constant varying the brightness), then I've used
hsv2rgb matlab command to make the transformation.
Now, I'd like to calibrate my monitor and then specifies the colors
of the stimuli in the absolute XYZ color space.
My lab has only a colorimeter (EYE-One 2 Display GretagMacbeth).
I'm trying to use the Image Processing Toolbox of Matlab. It has
some commands which read the profile ( iccread ) and make the
tranformation between XYZ and RGB color space (applycform).
So, every time the ratio r change I calculate the min and max xyY
coordinates of the sinusoid (x and y are constant, only Y varies).
Then I make two transformations:
XYZmin=xyYToXYZ(xyYmin');
XYZmax=xyYToXYZ(xyYmax');
Prof = iccread(`Profile.icm');
C = makecform('xyz2srgb');
rgbmin = applycform(XYZmin,C);
rgbmin=rgbmin*255;
rgbmax = applycform(XYZmax,C);
rgbmax=rgbmax*255;
And then I create the sinusoid between rgbmin and rgbmax values.
ampiezzaR=(rgbRmax-rgbRmin)/2; % amplitude red
ampiezzaV=(rgbVmax-rgbVmin)/2; % amplitude green
for t=1:3
shiftR(t)=(ampiezzaR(t)+rgbRmin(t));
shiftV(t)=(ampiezzaV(t)+rgbVmin(t));
end
% Red-black
rossa1=ones(height,width,3); % Rosso=red
for r=1:3
vector1(r,:)=sin(0:(passo):2*pi)*ampiezzaR(r)+shiftR(r);
end
sinRosso1=ones(width,1)*vector1(1,:);
sinVerde1=ones(width,1)*vector1(2,:);
sinBlu1=ones(width,1)*vector1(3,:);
for i=0:(frspaz-1)
rossa1((((i)*heightnew)+1):heightnew*(i+1),1:width,1)=sinRosso1';
rossa1((((i)*heightnew)+1):heightnew*(i+1),1:width,2)=sinVerde1'
rossa1((((i)*heightnew)+1):heightnew*(i+1),1:width,3)=sinBlu1';
end
%green-black out-of-phase by 180 degrees
verde1=ones(height,width,3);
for r=1:3
vector(r,:)=sin((0:(passo):2*pi)+pi)*ampiezzaV(r)+shiftV(r);
end
sinRosso=ones(width,1)*vector(1,:);
sinVerde=ones(width,1)*vector(2,:);
sinBlu=ones(width,1)*vector(3,:);
for i=0:(frspaz-1)
verde1((((i)*heightnew)+1):heightnew*(i+1),1:width,1)=sinRosso';
verde1((((i)*heightnew)+1):heightnew*(i+1),1:width,2)=sinVerde';
verde1((((i)*heightnew)+1):heightnew*(i+1),1:width,3)=sinBlu';
end
img1=rossa1+verde1; %red-green
Now, the entire code doesn't work (it worked perfectly using the HSV
coordinates).
Could someone tell me if my procedure is right?
How can I choose the x y chromaticity coordinates? Have I to use the
xy coordinates of the three phosphors? If yes, where can I find them?
Any help will be appreciated!
Many thanks in advance!!!
Roberta
I have to create chromatic red-green sinusoidal gratings at a
constant mean luminance (sum of the mean luminances of red and green
gratings).
The chromatic contrast patterns (red-green) were obtained by
superimposing out-of-phase by 180 degrees red-black and green-black
gratings of identical contrast. The ratio of red to total luminance
could be varied from 0 to 1 and this occurs at a constant Michelson
contrast both for green and red gratings.
I created the stimuli in the HSV space (for both colors I kept hue
and saturation constant varying the brightness), then I've used
hsv2rgb matlab command to make the transformation.
Now, I'd like to calibrate my monitor and then specifies the colors
of the stimuli in the absolute XYZ color space.
My lab has only a colorimeter (EYE-One 2 Display GretagMacbeth).
I'm trying to use the Image Processing Toolbox of Matlab. It has
some commands which read the profile ( iccread ) and make the
tranformation between XYZ and RGB color space (applycform).
So, every time the ratio r change I calculate the min and max xyY
coordinates of the sinusoid (x and y are constant, only Y varies).
Then I make two transformations:
XYZmin=xyYToXYZ(xyYmin');
XYZmax=xyYToXYZ(xyYmax');
Prof = iccread(`Profile.icm');
C = makecform('xyz2srgb');
rgbmin = applycform(XYZmin,C);
rgbmin=rgbmin*255;
rgbmax = applycform(XYZmax,C);
rgbmax=rgbmax*255;
And then I create the sinusoid between rgbmin and rgbmax values.
ampiezzaR=(rgbRmax-rgbRmin)/2; % amplitude red
ampiezzaV=(rgbVmax-rgbVmin)/2; % amplitude green
for t=1:3
shiftR(t)=(ampiezzaR(t)+rgbRmin(t));
shiftV(t)=(ampiezzaV(t)+rgbVmin(t));
end
% Red-black
rossa1=ones(height,width,3); % Rosso=red
for r=1:3
vector1(r,:)=sin(0:(passo):2*pi)*ampiezzaR(r)+shiftR(r);
end
sinRosso1=ones(width,1)*vector1(1,:);
sinVerde1=ones(width,1)*vector1(2,:);
sinBlu1=ones(width,1)*vector1(3,:);
for i=0:(frspaz-1)
rossa1((((i)*heightnew)+1):heightnew*(i+1),1:width,1)=sinRosso1';
rossa1((((i)*heightnew)+1):heightnew*(i+1),1:width,2)=sinVerde1'
rossa1((((i)*heightnew)+1):heightnew*(i+1),1:width,3)=sinBlu1';
end
%green-black out-of-phase by 180 degrees
verde1=ones(height,width,3);
for r=1:3
vector(r,:)=sin((0:(passo):2*pi)+pi)*ampiezzaV(r)+shiftV(r);
end
sinRosso=ones(width,1)*vector(1,:);
sinVerde=ones(width,1)*vector(2,:);
sinBlu=ones(width,1)*vector(3,:);
for i=0:(frspaz-1)
verde1((((i)*heightnew)+1):heightnew*(i+1),1:width,1)=sinRosso';
verde1((((i)*heightnew)+1):heightnew*(i+1),1:width,2)=sinVerde';
verde1((((i)*heightnew)+1):heightnew*(i+1),1:width,3)=sinBlu';
end
img1=rossa1+verde1; %red-green
Now, the entire code doesn't work (it worked perfectly using the HSV
coordinates).
Could someone tell me if my procedure is right?
How can I choose the x y chromaticity coordinates? Have I to use the
xy coordinates of the three phosphors? If yes, where can I find them?
Any help will be appreciated!
Many thanks in advance!!!
Roberta