02511: Exercise 2 - a guideline to exercise reports. John Doe Jane Doe February 20, 2017 Exercise 1 We want to find the angle θ (in degrees) in a right-angled triangle, given the adjacent cathetus (a) and the opposite cathetus (b), see Figure 1. Figure 1: Angle θ in a right-angled triangle. opposite cathetus b From math we know that tan(θ) = adjacent cathetus = a . So in order to find the angle θ we need to use the inverse tangent, arctangent i.e. atan2 in matlab. atan2 takes (opposite cathetus, adjacent cathetus) as arguments and returns the angle in radians. We know that pi is the same as 180◦ , thus, to convert the angle to degrees, the angle in radians must be multiplied with the conversion factor 180 π . We find that θ = 16.6992◦ . The Matlab code can be seen in Appendix A.1. Exercise 2 Since the function CameraBDistance.m should return b given f and g, we have to isolate b in Gauss’ lens equation: b= ( f1 1 − g1 ) (1) The function can be found in Appendix A.2. The function implemented was then used (as seen in Appendix A.3) to find out where the CCD should be placed, when the focal length is 15 mm and the object distance is 0.1, 1, 5, and 15 meters. 1 From matlab we get: f = 0.015 m b g = 0.1 m 0.0176 m g=1m 0.0152 m g=3m 0.0151 m g = 15 m 0.0150 m Table 1: The inner camera distance b found using Gauss’ lens equation (Equation 1) given f and g. Notice that the camera distance b decreases as g increases in such a way that b converges to f . Exercise 3 Five images of the same object are found on the following page. In Figure a and b, only the exposure time and aperture values differ and we notice a lightening of the image with large exposure time and aperture value. In Figure c the focal length is very different from b, while only the aperture value is the same as in b. The change of the focal length is very visible (we have zoomed). Figure d the aperture and exposure time is held constant compared to c. The focal length is increased however the flash seems to make this image very bright. On Figure e the flash has been switched off. The focal length is half the length used in c and the aperture values and exposure times are almost similar. 2 Figure a - Focal length:6 - Exposure time:0.1000 - Aperture value:6 Figure d - Focal length:72 - Exposure time:0.0167 - Aperture value:3.6250 Figure b - Focal length:6 - Exposure time:0.0040 - Aperture value:3.6250 Figure e - Focal length:10.2000 - Exposure time:0.0125 Aperture value:3.3438 Figure c - Focal length:20.2000 - Exposure time:0.0167 Aperture value:3.6250 Exercise 4 Thomas is G = 1.8 meters tall and standing g = 5 meters from the camera. The cameras focal length f is 5 mm. Figure 2 shows a drawing of the scene. The CCD in the camera can be seen in Figure 3. It is a 1/2” (inches) CCD chip and the image formed by the CCD is 640 × 480 pixels. Answers: 1. Using Gauss’ lens equation from equation 1 (the implemented function from exercise 2) the image of Thomas is formed approximately b = 0.005 m or 5 mm from the lens. 2. Knowing b, g and G, we can find Thomas’s height B on the CCD chip using the relationship b/B = g/G resulting in B = 1.8018 mm. 3. Since we have the height and width of the CCD in both mm and pixels, we can find the size of a single pixel in mm. E.g. the horizontal 4.8 mm size of the pixel is given as 480 pixel = 0.01 mm per pixel. Similar for the vertical size of the pixel. The vertical size of the pixel is 0.01 mm per pixel. 4. Thomas’ height in pixels can be found using his height in mm on the CCD and the horizontal pixel size. Thus, Thomas’ height (pixel) = 1.8018 mm 0.01 mm per pixel = 180.1802 pixels. 5. Figure 4 shows a drawing of the vertical field of view. We can find the field of view angle θ by looking at e.g. the upper right-angled triangle on Figure h 4. We used the same relation as in exercise 1, where tan( θ2 ) = h/2 b = 2b . h Thus, θvertical = 2 arctan 2b = 51.2373◦ . 6. The horizontal field of view is calculated in a similar way, using the width of the CCD instead of the height h. θhorizontal = 65.1864◦ . The Matlab code can be seen in Appendix A.4. 4 Figure 2: Thomas and the camera. Figure 3: The dimensions of a 1/2” CCD chip. The chip has 640×480 pixels. Figure 4: Vertical field of view 5 A Appendix: Matlab implementation A.1 Exercise 1 a = 10; b = 3; P = atan2(b,a); theta = P * 180.0 / pi A.2 Exercise 2 function b = CameraBDistance(f,g) % CameraBDistance returns the distance (b) where the CCD should be % placed when the object distance (g) and the focal length (f) % are given. b = 1/ (1/f − 1/g); A.3 Exercise 2 Matlab code f = 0.015; % f is converted to meters to match g. g = 0.1; b = CameraBDistance(f,g) g = 1; b = CameraBDistance(f,g) g = 3; b = CameraBDistance(f,g) g = 15; b = CameraBDistance(f,g) A.4 Exercise 4 %% Thomas and the camera % g % f % G % Thomas distance to camera (meter) = 5; Focal length (meter) = 0.005; Thomas height (meter) = 1.80; −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− %1) We use the function from exercise 2. The image is focused at b = CameraBDistance(f,g) % We now use the relation G/g = B/b 6 %2) The size of Thomas on the CCD (in mm) (B) B = G/g * b * 1000 %3a) Horisontal length of a pixel (in mm/pix) hsize = 6.4 / 640 %3b) Vertical length of a pixel (in mm/pix) vsize = 4.8 / 480 % Thomas height in pixels − mm/(mm/pix) = pix Mheight = B/hsize % Vertical field of view % Half height of chip (mm) h2 = 4.8 / 2; % Distance from chip to lens (mm) b = CameraBDistance(f,g) * 1000; % angle thV = 2 * atan2(h2, b); % Vertical field of view in degrees fov v = thV * 180.0 / pi % Horisontal field of view % Half width of chip (mm) w2 = 6.4 / 2; % Distance from chip to lens (mm) b = CameraBDistance(f,g) * 1000; % angle thH = 2 * atan2(w2, b); % Horisontal field of view in degrees fov h = thH * 180.0 / pi 7
© Copyright 2026 Paperzz