Computer Science - The City College of New York
CSc 59866/59867 Capstone I/II Fall 2015-Spring 2016

Assignment 1 ( Deadline: September 30 before class)

======================================================================

Note: All the writings must be in soft copies (PDF)  Please send the report (PDF) and the matlab code (*.m)  of your assignment to Prof. Zhu <zhu@cs.ccny.cuny.edu> as email attachments. You are responsible for the lose of your submissions if you don’t include  “Capstone 2015 ” (exactly) in the subject of your email. Send your source code ONLY – please don’t send in your images and executable. Do write your names and IDs (last four digits) in both your report and your matlab code files.


1. Writing Assignments (10x3 = 30 points)
 
(1). How does an image change (e.g., objects' sizes in the image, field of view, etc.) if the focal length of a pinhole camera is varied?
  (2). Give an intuitive explanation of the reason why a pinhole camera has an infinite depth of field.
  (3). Prove that, in the pinhole camera model, three collinear points (i.e., they lie on a line)  in 3D space are imaged into three collinear points on the image plane. You may either use geometric reasoning (with line drawings) or algebra proof (using equations).
 

2. Programming  Assignments (Matlab preferred - here is a quick matlab tutorial.  You may use C++ or Java if you like, but you will need to bring your  own machine to me in my office hours to run your programs. ) (70 points in total)

(1) (30 points) Image formation.  In this small project, you are going to use Matlab to read, manipulate and write image data. The purpose of the project is to make you familiar with the basic digital image formations. Your program should do the following things:

  1. Read in a color image C1(x,y) = (R(x,y), G(x,y), B(x,y)) in Windows BMP format, and display it.
  2. Display the images of the three color components, R(x,y), G(x,y) and B(x,y), separately. You should display three black-white-like images.
  3. Generate an intensity image I(x,y) and display it. You should use the equation I = 0.299R + 0.587G + 0.114B (the NTSC standard for luminance).
  4. The original intensity image should have 256 gray levels.  Please uniformly quantize this image into K levels ( with K=4, 16, 32, 64).  As an example,  when K=2 ,  pixels whose values are below 128 are turned to 0,  otherwise to 255.  Display the four quantized images with four different K levels  and tell us  how the images still look like the original ones.
  5. Quantize  the original three-band color image C1(x,y) into K level color images CK(x,y)= (R’(x,y), G’(x,y), B’(x,y)) (with uniform intervals) , and display them. You may choose K=2 and 4 (for each band).  Do they have any advantages in viewing and/or in computer processing (e.g. segmentation)?
  6. Quantize  the original three-band color image C1(x,y) into a color image CL(x,y)= (R’(x,y), G’(x,y), B’(x,y)) (with a logarithmic function) , and display it. You may choose  a function  I' =C ln (I+1) ( for each band), where I is the original value (0~255) , I' is the quantized value,  and C is a constant to scale I'  into (0~255), and ln is the natural logarithm.  Please find the best C value so for an input in the range of 0-255, the output range is still 0 - 255. Note that when I = 0, I' = 0 too.
Please for each of the above, provide your observations / conclusions, rather than just show the experimental results.
I have provided a piece of starting code for you to use. Questions a and b have been done.  You only need to work on c to g. You may use Prof. Zhu's old ID picture for testing your algorithm.

(2)(20 points) Generate the histogram of the image you are using, and then perform a number of histogram operations (such as contrast enhancement, thresholding and equalization) to make the image visually better for either viewing or processing (10 points).  If it is a color image,  please first turn it into an intensity image and then generate its histogram.  Try to display your histogram (5 points), and make some observations of the image based on its histogram (5 points). What are the general distributions of the intensity values? How many major peaks and valleys does your histogram have? How could you use the histogram to understand, analyze or segment the image? Please also display the histograms of the processed images and provide a few important observations.

(3). (20 points) Apply the 1x2 operator and Sobel operator to your image and analyze the results of the gradient magnitude images (including vertical gradients, horizontal gradients, and the combined) (10 points). Generate edge maps of the above two combined gradient maps (10 points).  An edge image should be a binary image with 1s as edge points and 0s as non-edge points. You may first generate a histogram of each gradient map,  and only keep certain percentage of pixels  (e.g.  5% of the pixels with the highest gradient  values) as edge pixels (edgels) . Use the percentage to automatically find a threshold for the gradient magnitudes. In your report, please write up the description and probably equations for finding the threshold, and discuss if 5% is a good value. If not what is ?  In the end, please try to generate a sketch of an image, such as the ID image of Prof. Zhu.