CSE/EE 486:  Fundamentals of Computer Vision


      Computer Project Report #4:

      The Image-Irradiance Equation

      Group #11: Howard Elikan, Jim Geis and Anirudh Modi

      April 22, 1999


      1. Objectives:
        To apply the concepts of image-irradiance equation, illumination, suface reflectivity, and the monocular image geometry to create an image of an illuminated 3D scene.

      2. Methods:
        The method we use to map the 3D sphere to the 2D image plane is different than most others. Instead of finding the corresponding spherical point for each image pixel, we sample points on the viewable cap of the sphere and then map them to the image plane. The figure below shows what portion of the sphere we are working with. The shaded cap lies within the line that is tangent to the sphere.

        Since only the shaded part of the sphere is visible to the lens, it is sufficient to map only points on the cap to the image plane. Finding the output image takes a few steps:

        1. The entire image is painted the background intensity, which has the value 64.
        2. The angle theta is found to determine the size of the cap visible to the lens. Angle theta is the angle at which a line passing through the lens just grazes the surface of the sphere. Notes from Lecture 20 assisted in calculating angle theta.
        3. Sample points on the cap are mapped to the image plane. The mapping is performed in nested FOR loops, with one counter going from theta to 180-theta, covering the angle between the optical axis and the line tangent to the sphere. The other counter goes from phi to 180-phi, so that for each angle, all points around the circle are mapped. For each point sampled, its radiance is determined, normalized, then mapped to the image plane.

      3. Results:
        The program was first executed using the parameters [Ps,Qs,z0] = [0,0,30]. With Ps and Qs equal to zero, the light source is on the z-axis pointing at the center of the sphere. One would expect to see a complete cap of the sphere with the most light intensity at the center of the cap. That is exactly how the output image appears, shown in Figure 1. The program was then executed using the parameters [Ps,Qs,z0] = [0,0,20]. The result is very similar as before, except the sphere will appear closer to the camera (Figure 2).

        The third test run for the program was done using the parameters [Ps,Qs,z0] = [0,1,35]. With a positive value for Qs, the light source is pointing downward onto the sphere. The visible cap of the sphere will be towards the top of the sphere as it is viewed in our image. The output image for this test run is shown in Figure 3.

        The next test run for the program was done using the parameters [Ps,Qs,z0] = [1,1,35]. With positive values for Ps and Qs, the light source is above the sphere and to the right of its center. The visible cap of the sphere will be towards the top of the sphere, but the intensity center of the cap will be to the right of the sphere's center. The output image for this test run is shown in Figure 4.

        More test runs with similar parameters were done to verify the correctness of our program. The output images for those runs can be seen in Figure 5 and Figure 6. The parameters that were used are shown in the captions.

        Another test run was done using the parameters [Ps,Qs,z0] = [1000,0,45]. The huge positive value for Ps indicates that the light source is far to the right of the sphere. It is so far to the right, that it appears as if it is pointing directly left onto the sphere. Thus, the visible cap will be on the right side of the sphere, and we will only be able to see half of the cap. The increased value for z0 also means the sphere is further away from the camera and will appear to be smaller. The output image for this test run is shown in Figure 7.

        The final test run was done using the paramters [Ps,Qs,z0] = [0,1000,45]. The output image is similar to that of the previous test run except the visible cap is now on the top of the sphere. This image is shown in Figure 8.

        Here is a sample text output from executing the program:

        ------------------------------------------------------------------------------
        Radius of sphere = 4
        Focal length of camera lens = 5
        Range of image plane = [-1,1]x[-1,1]
        ------------------------------------------------------------------------------
        p_s = 0
        q_s = 0
        z0 = 30
        Direction of point source = [-0,-0,1] = [-0.000,-0.000,1.000]
        ------------------------------------------------------------------------------
        Radius of sphere on image plane = 0.810441
        Number of points sampled for image plane = 415x415 = 172225
        
        Generating shading information.....
        100% Completed!
        Consumed 6.0 seconds.
        ------------------------------------------------------------------------------
        Writing 256x256 image to file "/tmp/sphere.ppm"...done!
        ------------------------------------------------------------------------------
        

      4. Conclusion:
        Our results are exactly how we expected them to look. As Ps is increased, the sphere is viewed as if the light source has been moved to the right. As Qs is increased, the sphere is viewed as if the light source has been moved upward. As z0 is increased, the sphere is viewed as if it is further away from the camera. Because the program produced the expected output for a sufficient number of test cases, we can assume that it was implemented correctly and that the objectives of the assignment were met.

      5. Appendix:
        All images are 256 x 256.

        Figure 1: [Ps,Qs,z0] = [0,0,30] Figure 2: [Ps,Qs,z0] = [0,0,20]

        Figure 3: [Ps,Qs,z0] = [0,1,35] Figure 4: [Ps,Qs,z0] = [1,1,35]

        Figure 5: [Ps,Qs,z0] = [0.2,0.4,30] Figure 6: [Ps,Qs,z0] = [3,2,30]

        Figure 7: [Ps,Qs,z0] = [1000,0,45] Figure 8: [Ps,Qs,z0] = [0,1000,45]

        Source code:

          The file matrix.h is the header file for the class of functions for matrix operations (C++).

          The file matrix.cc is the implementation file for the class of functions for matrix operations (C++).

          The file image.h is the header file for the class of functions for image manipulation (C++).

          The file image.cc is the implementation file for the class of functions for image manipulation (C++).

          The file main.cc is the main driving routine for this project (C++).

        Note: Special run scripts are necessary to execute the code.   For a complete copy of the code, scripts, and objects, click here.   After you have downloaded the file:

        1. Type "gunzip -c project4.tar.gz | tar -xvf -"
        2. Type "./run [Ps] [Qs] [z0]" to execute the code

        Binary:

          Binary for SunOS: proj4sunOS
          Binary for Linux: proj4linux