# s3 - #10 ECE 253a Digital Image Processing Pamela Cosman...

This preview shows pages 1–4. Sign up to view the full content.

#10 ECE 253a Digital Image Processing Pamela Cosman 10/27/11 Solutions for Homework 3 1. Chromaticity diagrams: Here is the matlab code to plot the tristimulus values: >> load cie -ascii >> l = cie(:,1); >> X = cie(:,2); >> Y = cie(:,3); >> Z = cie(:,4); >> plot(l,X,’r-’,l,Y,’g--’,l,Z,’b-.’); Here is the code to plot the chromaticity diagram. The connected line of purples is obtained by simply tacking the first point of each vector on to its end: >> x = X ./ (X+Y+Z); >> y = Y ./ (X+Y+Z); >> x = [x;x(1)]; >> y = [y;y(1)]; >> plot(x,y) You were given the conversions from XYZ to RGB. What we need, however, is to convert from RGB to XYZ in order to plot in the xy chromaticity diagram. Specifically, we need to convert each of the pure phosphor colors to XYZ, then to xy. For example, the vector [1 0 0]’ represents the pure NTSC red phosphor. That is, it is the NTSC red primary expressed in the NTSC coordinates. By using the inverse of the given matrix, we can convert this (1 0 0) point from the NTSC space to the XYZ space. Likewise, we have to convert (0 1 0) and (0 0 1) to the XYZ space. These three XYZ tristimulus values then get converted to xy and plotted in the xy plane. Here is the code to plot the NTSC triangle inside the xy-chromaticity horse-shoe: >> Nmat = [1.910 -0.532 -0.288; -0.985 2.0 -0.028; 0.058 -0.118 0.898]; >> invNmat = inv(Nmat); >> xyzR = invNmat * [1 0 0]’; >> xR = xyzR(1) / sum(xyzR); >> yR = xyzR(2) / sum(xyzR); xyzG = invNmat * [0 1 0]’; >> xG = xyzG(1) / sum(xyzG); >> yG = xyzG(2) / sum(xyzG); >> xyzB = invNmat * [0 0 1]’; >> xB = xyzB(1) / sum(xyzB); 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
>> yB = xyzB(2) / sum(xyzB); >> a = [xR xG xB xR]; >> b = [yR yG yB yR]; >> plot(x,y,a,b) >> grid We do the same thing to get the SMPTE phosphors. The NTSC set is bigger, although we have to remember that the space is not perceptually uniform, and so the amount of advantage can’t be estimated from this diagram. 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 SMPTE NTSC 2. Adding Colors (a) Tristumulus values are additive. The tristimulus values for W are (1,1,1). So if we use R,G,B to denote the tristimulus values for color A, we have R = 1 2 ( T 1 + 1) and G = 1 2 ( T 2 + 1) and B = 1 2 ( T 3 + 1) The chromaticity coordinates are r = R R + G + B = T 1 + 1 T 1 + T 2 + T 3 + 3 and g = G R + G + B = T 2 + 1 T 1 + T 2 + T 3 + 3 (b) We are told that t 1 = t 2 = 0 . 1 so we know that T 1 T 1 + T 2 + T 3 = T 2 T 1 + T 2 + T 3 = 0 . 1 2
and in particular we can conclude that T 1 = T 2 . Also T 1 = 0 . 1( T 1 + T 2 + T 3 ) = 0 . 1(2 T 1 + T 3 ) Multiplying by 10, we get 10 T 1 = 2 T 1 + T 3 and so T 3 = 8 T 1 . The tristimulus values for color C are therefore ( T 1 ,T 1 , 8 T 1 ). So we know that T 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern