Digital Image Processing HW#1 Solution 02/05/2004 TA: Jessie Hsu yh2117@columbia.edu 1. Design of an image acquisition system: (a) Image acquisition system (b) Derivation of pixel size (c) Minimum coverage of image of dark blob From (b), every imaging element is a square measuring 8mx8m, with spaces between two 2m, therefore we consider each pixel to be a square of size 10m10m = 0.01mm0.01mm. From (c), we can see that, for the image of the dark blob to fully cover 22 pixels, we need it to cover 33 pixels such that even when it shifts a little bit, there are 22 pixels guaranteed to be covered. 1 Accordingly, it is the square inside the dark blob that should be projected onto 33 pixels, rather than the dark blob itself. So we have the square measuring D D . 2 2 (d) From the diameter of dark blob to the dimension of the square inside it Specifications: L = 80 mm D = 0.8 mm ( the diameter of the dark blob ) f = 25k mm ( k = 1, 2, …, 8 ) 35k mm ( k = 1, 2, …, 5 ) w = 51210 m = 5120.01 mm = 5.12 mm 102410 m = 10240.01 mm = 10.24 mm 204810 m = 20480.01 mm = 20.48 mm v = 310 m = 30.01 mm = 0.03 mm This is an open problem, and there is not a single answer to it. Here are two ways that you can approach the problem. Approach 1. Geometry analysis: Observing the imaging geometry in (a), we have 2 equations D 2 v a f L w a f (1) ( from the geometry ) (2) ( for the viewing screen to be entirely projected onto CCD array ) The task is to determine a, f, w such that w gives us the lowest cost. 2 (2) 2 2 w vL 0.03 80 3 2 4.24mm (1) D 0.8 So we choose w = 5.12 mm ( the lowest cost ) f can be arbitrarily chosen, as long as the corresponding a is determined as D f 40 a 2f 3 2 v We want a to be small, so that there will be less noise in the imaging process. One possible choice is f = 35mm a = 659.97 mm or 0.66 m Approach 2. Rather than setting the = sign in (1), we relax it to D 2 v a f L w a f (3) ( from the geometry ) (4) ( for the viewing screen to be entirely projected onto CCD array ) Then we have a lower bound and an upper bound for the ratio R L D R w 2v R 18.86 Rmax a f (5) (6) by analysis of the geometry again, we can see that the minimum resolution of the L CCD camera has to be Rmax 0.01 80 429.65 (7) 18.86 0.01 which means the camera must have resolution greater than 430430. In our specifications, 512512 will do the job, so we fix w to be 5.12 mm. Then the lower bound of R becomes L 80 15.62 w 5.12 The parameters can therefore be determined by choosing a ratio between the lower bound and the upper bound followed by choosing a focal length not to small ( lower cost on lens ) and choosing an a not too large ( for less noise ). One possible choice is R = 16 f = 35 mm a = 560 mm = 0.56 m 3 2. You can calculate the results either by a simple MATLAB script or by hand calculation. Here is an example MATLAB script: % HW 1, Prob 2 clear; clr=zeros(3,6); % Colors in NTSC RGB clr(:,1)=[1 0 0]'; % Red clr(:,2)=[1 1 0]'; % Yellow clr(:,3)=[0 1 0]'; % Green clr(:,4)=[0 1 1]'; % Cyan clr(:,5)=[0 0 1]'; % Blue clr(:,6)=[1 0 1]'; % Magenta % Convert to CIE RGB A=[1.167 -0.146 -0.151 0.114 0.753 0.159 -0.001 0.059 1.128]; cclr=A*clr; % Convert to I,V1,V2 B=[1/3 1/3 1/3 -1/sqrt(6) -1/sqrt(6) 2/sqrt(6) -1/sqrt(6) 1/sqrt(6) 0]; IV=B*cclr; % Convert to HSI hclr=zeros(3,6); % Hue, Saturation, Intensity hclr(3,:)=IV(1,:); % Intensity for k=1:6 v1=0; v1=IV(2,k); v2=0; v2=IV(3,k); hclr(1,k)=atan(v2/v1); % Hue hclr(2,k)=sqrt(v1^2+v2^2); % Saturation end Starting with NTSC RGB colors Red Yellow R 1.0 1.0 G 0 1.0 B 0 0 Green 0 1.0 Cyan 0 1.0 Blue 0 0 Magenta 1.0 0 0 1.0 1.0 1.0 Blue -0.1510 0.1590 1.1280 Magenta 1.0160 0.2730 1.1270 We will get the CIE RGB color representations Red Yellow Green Cyan R 1.1670 1.0210 -0.1460 -0.2970 G 0.1140 0.8670 0.7530 0.9120 B -0.0010 0.0580 0.0590 1.1870 4 Performing the RGB to HSI conversion, we obtain H S I Red 0.6873 0.6776 0.4267 Yellow 0.0867 0.7261 0.6487 Green -1.0726 0.4178 0.2220 Cyan 0.6022 0.8714 0.6007 Blue 0.1370 0.9264 0.3787 Magenta -0.6561 0.4972 0.8053 Therefore (a) Magenta has the highest intensity. (b) Blue has the highest saturation. [Bonus] MATLAB code for displaying the colors: % Display the colors M=64; img=zeros(M,M*6,3); for k=1:6 img(:,(k-1)*M+1:k*M,1)=clr(1,k); img(:,(k-1)*M+1:k*M,2)=clr(2,k); img(:,(k-1)*M+1:k*M,3)=clr(3,k); end figure imshow(img) set(gcf,'color',[1,1,1]); title({'Display of the 6 colors in NTSC RGB','Red, Yellow, Green, Cyan, Blue, Magenta'}); imgcie=zeros(M,M*6,3); for k=1:6 if cclr(1,k)<0 imgcie(:,(k-1)*M+1:k*M,1)=0; elseif cclr(1,k)>1 imgcie(:,(k-1)*M+1:k*M,1)=1; else imgcie(:,(k-1)*M+1:k*M,1)=cclr(1,k); end if cclr(2,k)<0 imgcie(:,(k-1)*M+1:k*M,2)=0; elseif cclr(2,k)>1 imgcie(:,(k-1)*M+1:k*M,2)=1; else imgcie(:,(k-1)*M+1:k*M,2)=cclr(2,k); end if cclr(3,k)<0 imgcie(:,(k-1)*M+1:k*M,3)=0; elseif cclr(3,k)>1 imgcie(:,(k-1)*M+1:k*M,3)=1; else imgcie(:,(k-1)*M+1:k*M,3)=cclr(3,k); 5 end end figure imshow(imgcie) set(gcf,'color',[1,1,1]); title({'Display of the 6 colors in CIE RGB','Red, Yellow, Green, Cyan, Blue, Magenta'}); Observations and remarks: 1. In displaying the colors in CIE RGB, the values are clipped to 0~1 so that imshow can be used correctly. 2. The colors represented in CIE RGB have values less than zero or greater than one. This means these colors cannot be reproduced in the real world because they are outside the RGB color cube. 3. Observing CIE RGB, perceptually, magenta exhibits the maximum intensity, followed by cyan. The most saturated colors are blue and red (from CIE RGB). These facts roughly match the experimental results we get. Possible mismatch can be due to the clipping of RGB values in CIE RGB, which results in changes in intensity, hue, and saturation values. 4. NTSC RGB is used in televisions, while CIE RGB is used in computers. 6