Page 106 -
P. 106

2.5 Exercises                                                                           85


               Ex 2.7: Gamma correction in image stitching  Here’s a relatively simple puzzle. Assume
               you are given two images that are part of a panorama that you want to stitch (see Chapter 9).
               The two images were taken with different exposures, so you want to adjust the RGB values
               so that they match along the seam line. Is it necessary to undo the gamma in the color values
               in order to achieve this?

               Ex 2.8: Skin color detection  Devise a simple skin color detector (Forsyth and Fleck 1999;
               Jones and Rehg 2001; Vezhnevets, Sazonov, and Andreeva 2003; Kakumanu, Makrogiannis,
               and Bourbakis 2007) based on chromaticity or other color properties.

                  1. Take a variety of photographs of people and calculate the xy chromaticity values for
                    each pixel.

                  2. Crop the photos or otherwise indicate with a painting tool which pixels are likely to be
                    skin (e.g. face and arms).

                  3. Calculate a color (chromaticity) distribution for these pixels. You can use something as
                    simple as a mean and covariance measure or as complicated as a mean-shift segmenta-
                    tion algorithm (see Section 5.3.2). You can optionally use non-skin pixels to model the
                    background distribution.

                  4. Use your computed distribution to find the skin regions in an image. One easy way to
                    visualize this is to paint all non-skin pixels a given color, such as white or black.

                  5. How sensitive is your algorithm to color balance (scene lighting)?

                  6. Does a simpler chromaticity measurement, such as a color ratio (2.116), work just as
                    well?


               Ex 2.9: White point balancing—tricky  A common (in-camera or post-processing) tech-
               nique for performing white point adjustment is to take a picture of a white piece of paper and
               to adjust the RGB values of an image to make this a neutral color.

                  1. Describe how you would adjust the RGB values in an image given a sample “white
                    color” of (R w ,G w ,B w ) to make this color neutral (without changing the exposure too
                    much).

                  2. Does your transformation involve a simple (per-channel) scaling of the RGB values or
                    do you need a full 3 × 3 color twist matrix (or something else)?
                  3. Convert your RGB values to XYZ. Does the appropriate correction now only depend
                    on the XY (or xy) values? If so, when you convert back to RGB space, do you need a
                    full 3 × 3 color twist matrix to achieve the same effect?
                  4. If you used pure diagonal scaling in the direct RGB mode but end up with a twist if you
                    work in XYZ space, how do you explain this apparent dichotomy? Which approach is
                    correct? (Or is it possible that neither approach is actually correct?)
               If you want to find out what your camera actually does, continue on to the next exercise.
   101   102   103   104   105   106   107   108   109   110   111