1. Install VIPER and mount standard libraries. Follow the directions. Feel free to use the machines in the first floor lab which are described on the class web page.
2. You will need a function that computes the histogram of an RGB color image. The function should accept a variable N which specifies the number of bins to use for each of the R, G, and B axes. So the total number of bins would be N^3. Your histogram should be normalized so that the sum over all of the bins equals 1. We can interpret the number in each bin as the probability of encountering pixels with the corresponding range of RGB values.
3. It's a good idea to test your function with a small number of bins and a hand-contructed test image for which you know exactly what the right answer should be.
4. Write a function called detectpixels which identifies the pixels in an input image which have high probability with respect to a histogram model. This function takes a histogram, an image, and a threshold and computes a label for each pixel. The first step is to compute the probability for each pixel as measured by the histogram. This is done by computing the associated bin for a pixel and retrieving the contents of the bin as the probability. Next the probability is compared to the threshold to obtain a label of 0 (below threshold) or 1 (above). Your function should produce an output image that consists of a copy of the input image in which all of the pixels with a label of 1 have been replaced by the value (0,0,255).
For example, suppose that pixel (25,40) in the input image has RGB value (10,34,20). Suppose that it maps to bin (1,3,2) in the histogram and the probability in that bin is 0.005. With a threshold T < 0.005, the output image will contain (0,0,255) at location (25,40). Otherwise it will contain (10,34,20).
5. Write a program which reads an an input image and an AVI file and outputs an AVI file. The program should use the input image to construct a histogram with N=64. Then it should use a threshold of T=0.81 to label each pixel in each frame of the AVI file. The result will be a new AVI file in which all of the detected pixels are drawn in blue.
6. Run the program with the following input image and AVI file. Answer the following questions:
7. Turn in your executable file, the output AVI file from part (6), and your answers to the questions.