COLLECTED HOMEWORK NUMBER ONE
DUE: TUESDAY, SEPTEMBER 18, 2007 at 10:00AM
TITLE: HISTOGRAM
Email material to rsg.introcv.gmail.com
INTRODUCTION TO COMPUTER VISION 2007_1



In this assignment you will write a Matlab function that will have the following general capabilities(details below):
a. Read in an image
b. Extract a specified region
c. Reverse the orientation of the region and insert back into image
d. Switch (interchange) the red and blue panes of the region
e. Write your own code to create a histogram using the MATLAB plot function (do NOT use MATLAB's built in Histogram function).
THIS HOMEWORK MUST BE DONE INDIVIDUALLY

Specifically:

Write a MATLAB Function, not a script. Name the function CV2007_1HW1yourName (replace yourName with your actual name, i.e., CV2007_1HW1Gaborski.m ) (2 points). Your function should work with any color image
Potential Points
2
Actual
Points
Your function should accept the parameters: image matrix,  first row, last row, first column, last column (5 points)
Outside of the function, create the image matrix by reading in the image file using imread and assign the matrix to a variable that will be used as a parameter. The imread statement is not part of your function. It is used to assigned the image to a variable which is a parameter of your function.
Parameters first row, last row, first column, last column define the boundaries of the extracted image region
5

Your function should:
1. Display image and title image: Image (1 point)
2. Reverse the rectangular region (top to bottom, see example below), known as the ‘region of interest’, ROI, defined by first row to last row and first column to last column.  Additionally, the red and blue color planes in the ROI are switched. Re-insert extracted region into image. Display the image and title image:Reverse-switch. (The implementation of step 2 in the function must contain five or fewer lines of code)(9 points)
3.In addition, extract the original (no flipping or color change) region defined by first row, last row, first column, last column using colon operator  and assign to variable imCrop No loops (2 points)
4. Display the cropped image and title Extracted Image (1 points)
5. Create and display a histogram of the red data only (original red data - before reversing colors)  of the extracted image with 256 bins  using MATLAB's plot function. (DO NOT USE MATLAB's histogram functions - use of these functions will result in a grade of zero for this homework). The image code values should be in the 0 to 255 range.Display histogram data using the red color.  Make sure the histogram accurately displays the number of pixels with zero intensity value. Label completely as show in example below. (5 points)

1


9

2

1

5

email to : rsg.introcv@gmail.com
1. A Word document detailing the operation of your program. How does it work? How did you handle the 0 code values
2. E-mail your code to rsg.introcv@gmail.com account  
3. E-mail the output images and histogram
4. DO NOT ZIP YOUR FILES.


5
5

TEST DATA:
1.Read in image PinkHotel  and extract region ( 300,600,300,600 ). Turn in (via email) the image with the extracted region reversed,  the histogram for the red pixel data of  the extracted region. Label correctly. (5 points)
5

2. Read in image audi_q.jpg  and extract region ( 150,200,150,200). Turn in (via email) the image with the extracted region reversed, the histogram for the red pixel data of the extracted image Label correctly. (5 points)
5


Example Results (ignore aspect ratio of image):

image  
Reverse-switch

Examples of what images and histograms your code should create and display when your program is run (but 'extracted' should be spelled correctly):

Extracted Image
Red Histogram