Cornell CS465 Spring 2003 NOTE: This file will only be fully legible if you view it in a fixed-width font. Solutions for Prelim 1 ---------------------- Problem 1 1.1. Since monitor B has the higher exponent, the same input will produce a lower output (a^3 < a^1.5 when 0 < a < 1). 1.2. Since monitor B produces darker intensities for the same input, the 256 available shades of gray will be more concentrated toward the dark end of the intensity range. Hence B has better intensity resolution for dark colors. 1.3a. Since 1.1 said images always look darker when displayed on B, an image that is adjusted to look correct on A will look too dark on B. 1.3b. In order to produce 1/2 the maximum intensity, monitor A requires the input a = (1/2)^(2/3) (so that a^(3/2) = 1/2). If we feed this same input to monitor B we will get the intensity a^3, or ((1/2)^(2/3))^3 which is just (1/2)^2 or 1/4. Problem 2 The general equations that are relevant here is r_C = r_F + (1 - a_F) r_B a_C = a_F + (1 - a_F) a_B The answers are by substituting the given values and simplifying. Under premultiplied alpha it *is* generally allowed for the color channels to be greater than alpha, but since we didn't stress this it was fine to assume r_X = 0 when a_X = 0 (these alternate answers are in [] below). 2.1a. r_C = r_F + (1 - 0) r_B = r_F + r_B [or r_B] a_C = 0 + (1 - 0) a_B = a_B 2.1b. r_C = r_F + (1 - 1) r_B = r_F a_C = 1 + (1 - 1) a_B = 1 2.1c. r_C = r_F + (1 - a_F) r_B [or r_F] a_C = a_F + (1 - a_F) 0 = a_F 2.1d. r_C = r_F + (1 - a_F) r_B a_C = a_F + (1 - a_F) 1 = 1 2.1e. r_C = r_F + (1 - 1/2) r_B = r_F + r_B/2 a_C = 1/2 + (1 - 1/2) 1/2 = 3/4 2.1f. r_C = r_F + (1 - r_F) 0 = r_F a_C = a_F + (1 - a_F) 1 = 1 Problem 3 3.1a. The resulting image is a checkerboard made up by tiling the cell 4/9 5/9 5/9 4/9 3.1b. The repeating cell is 1/2 1/2 1/2 1/2 3.2a. The resulting image repeats with a period of 6 by 6 pixels. The repeating cell also has 8-way symmetry, which makes it easier to fill in the values. The repeating cell is 0 0 1 1 1 0 0 0 1 1 1 0 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 0 0 1 1 1 0 Many people didn't align the top left entry of the answer with a 0 in the input (as the problem asked), instead opting for the more pleasing 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 which was also fine. 3.2b. The repeat is again 6 by 6: 0 1/3 2/3 1 2/3 1/3 1/3 4/9 5/9 2/3 5/9 4/9 2/3 5/9 4/9 1/3 4/9 5/9 1 2/3 1/3 0 2/3 1/3 2/3 5/9 4/9 1/3 4/9 5/9 1/3 4/9 5/9 2/3 5/9 4/9 or, as above, 4/9 1/3 4/9 5/9 2/3 5/9 1/3 0 1/3 2/3 1 2/3 4/9 1/3 4/9 5/9 2/3 5/9 5/9 2/3 5/9 4/9 1/3 4/9 1/3 1 2/3 1/3 0 2/3 5/9 2/3 5/9 4/9 1/3 4/9 Problem 4 4.1. The parametric equations are: x = cos (pi u) y = -sin (pi u) sin (2 pi v) z = sin (pi u) cos (2 pi v) Of course there are various equivalent ways of writing this, for example by replacing cos (pi u) by -sin (pi u - pi/2) and sin (pi u) by cos (pi u - pi/2) I can't think of any other solution that is well-oriented and also fulfills the constraints, but one may certainly exist. ================== Further discussion ================== This isn't part of the answers themselves but may help you understand the answers more completely. Problem 3 3.1a. The 3x3 box filter is just a 3x3 filter with all entries the same: [ 1 1 1 ] (1/9) * [ 1 1 1 ] [ 1 1 1 ] The 1/9 is because the sum has to be 1. Convolving the checkerboard with this filter amounts to positioning the filter centered at each pixel and counting the number of 1s it covers (because the 0s don't contribute). When we center this 3x3 area on a 0, it covers 4 1s, resulting in a sum of 4/9. When we center it on a 1, it covers 5 1s, resulting in a sum of 5/9. 3.1b. The quickest way to the answer, which is that the image is completely uniform, is by separable filtering. Convolve first with the single-row filter [1 4 6 4 1] / 16, and the two cases are (4 + 4) / 16 (when centered on a 0) and (1 + 6 + 1) / 16 (when centered on a 1). This results in a uniform value of 1/2, which will not be changed by the second convolution with the single-column filter. Or, you could work out the whole 5x5 filter and add up the entries, which will come out to 128/256 both ways. 3.2a. To find this answer, make the 6x6 grid (I added a 7th row and column for context) and mark where the samples in the original image fall: 0 * * 1 * * 0 * * * * * * * * * * * * * * 1 * * 0 * * 1 * * * * * * * * * * * * * * 0 * * 1 * * 0 Now fill in each space with the value of the nearest original sample. If you remember what nearest neighbor resampling is you can do this immediataly. If you instead use the box of radius 1/2, then you're averaging all the samples within a 1x1 area of the source image centered at the point you are reconstructing in the high resolution image, which will always contain exactly one sample. 3.2b. As with 3.1b, the easy way is by separable filtering and by remembering that this filter implements linear interpolation. Then you can start by filling in the 0s and 1s: 0 * * 1 * * 0 1 * * 0 * * 1 0 * * 1 * * 0 and interpolating linearly (that is, in equal steps) along the rows to get 0 1/3 2/3 1 2/3 1/3 0 1 2/3 1/3 0 1/3 2/3 1 0 1/3 2/3 1 2/3 1/3 0 Then you do the same thing in the vertical direction: 0 1/3 2/3 1 2/3 1/3 0 * * * * * * * * * * * * * * 1 2/3 1/3 0 1/3 2/3 1 * * * * * * * * * * * * * * 0 1/3 2/3 1 2/3 1/3 0 and interpolating along the columns: 0 0 1/3 1/3 * 1/3 * 4/9 * 2/3 * 5/9 1 ---> 1 ; 2/3 --> 2/3 ; and so on... * 2/3 * 5/9 * 1/3 * 4/9 0 0 1/3 1/3 to arrive at the answer. If you don't remember the linear interpolation interpretation of the tent filter, it's still pretty easy to do the separable filtering using the definition of reconstruction: when you center the tent at a sample, all other samples fall outside the support, and when you center it at one of the other samples, the closer one gets weight 2/3 and the farther one gets weight 1/3. If you didn't remember about separable filtering, you could also do it in one step using the multiplied-out 2D tent filter. Problem 4 I started by disregarding the center and making a sphere at the origin, and by assuming that I'd use a parameterization that looks like the standard one, with the coordinates sin (pi s) sin (2 pi t) sin (pi s) cos (2 pi t) cos (pi s) I leave these unlabeled because I haven't yet decided which should be x, y, or z (this will depend on where I want the poles to be), and I use s and t because I'm not yet sure which is u and which is v. The first two equalities given in the problem determine the poles of the sphere. The poles will be at u = 0 and u = 1 or at v = 0 and v = 1, and since the first two points are at opposite corners of the (u,v) square they must be the poles. Since these points are at +/- (1,0,0) from the center, the polar axis must be the x axis, so we have x = cos (pi s) sin (pi s) sin (2 pi t) sin (pi s) cos (2 pi t) The third equality reveals that u is s, the variable that runs from pole to pole, because it shows us a point with v == 0 that is not at a pole. Therefore v is t. It also reveals which equation is for y and which is for z, since we are supposed to be at +(0,0,1) from the center when s = 1/2 and t = 0. Filling in this information we have x = cos (pi s) y = sin (pi s) sin (2 pi t) z = sin (pi s) cos (2 pi t) The only issues left are the orientation and the center. The center is easy: just add it to the three coordinates: x = 1 + cos (pi s) y = 2 + sin (pi s) sin (2 pi t) z = 3 + sin (pi s) cos (2 pi t) For the orientation you pretty much have to draw the diagram (I had already drawn it by this time in figuring out which was y and which was z). If you look at the point (1/2, 0), u increases in the -x direction and v increases in the +y direction. The cross product of these is -z, which points toward the inside. So we need to flip the orientation without messing with the x or z coordinates, which leaves flipping y to get the final answer: x = 1 + cos (pi s) y = 2 - sin (pi s) sin (2 pi t) z = 3 + sin (pi s) cos (2 pi t)