$29
If you just joined the course, Get a Matlab the RIT installation page:
When I run Matlab, I sometimes need to run the RIT VPN so that my license works. You might need to also.
http://www.rit.edu/its/services/personal-computers/software
Download and install Matlab.
Install all possible toolboxes you are offered (sub-components of Matlab).
WHAT TO HAND IN:
A. Create a directory named HW_01_<YourFirstName>_<YourLastName>_DIR. Notice that there are no spaces or whitespace in the directory name.
Use this exact naming convention. We run a script on our end that expects this.
When you turn in your homework, you will turn in this entire directory in one zip file.
The zip file must unzip to create the directory. I do not want to hunt around, sort, and re-name a hundred files.
If your submission unzips to a set of individual files in the current directory, those files will be deleted on our end, and you get a zero for the homework.
It is good practice zip up your homework, then unzip it in a temporary directory, and be sure it creates a directory that is populated. Verify that it works.
B. In that directory, create a word document named HW_NN_<YourFirstName>_<LastName>.docx Make the obvious substitutions.
Again, we use a script to process your homework assignments. Again, have no spaces in the filename.
In your homework document, at the top put your FirstName, and LastName.
I get to know students by first name only, but even in a small class, we sometimes have two students named Adam, or Juan, or Mathew or Aditya. ☺
1. (1) You are provided with an image named “Jairaj_for_HW_01_handout”, or similar. In your write-up, report the position of the tip of Jairaj’s nose:
( Use ginput(). ) Answer, in your write-up:
Column =
Row =
2. (1) Create a grayscale version of Jairaj.
im_rgb = imread(‘Jairaj_for_HW_01_handout.jpg’);
im_gray = rgb2gray( );
imagesc( im_gray );
colormap( gray(256) );
axis image;
Answer the questions:
Looking at the grayscale image, do you notice anything wrong with it?
Do you notice any watermarks, writing, or copyright information on the image?
3. (1) Starting with the previous im_gray image, create a boolean image (logical) image which is TRUE everywhere the gray value is less than a value of 180. Display this image.
Notice: it will be important to be able to operate on parts of images later on.
b_low_values = im_gray < 180; imagesc( b_low_values );
Answer the questions:
What does this image look like:
What is the data type of b_low_values?
4. (1) Instead of using rgb2gray( ), we might want to use just one color channel.
Write a program to create three figures, and display each separate red, green, and blue color channel individually.
Answer the questions:
a. Does the green channel best mimic the grayscale value?
b. Which channel has the WORST quality? What is wrong with it? What do you notice in this channel?
What kinds of artifacts did you notice in this channel?
(continued…)
5. (1) Having an image of someone with their head tilted, looks more dynamic.
The image looks like there is motion involved. The tilt draws the eyes into the image.
Many students use images like this on their resumes.
So, using your image of YOURSELF. Convert it to grayscale, using the green color channel. Then rotate the image so that the face is going up to the right. For Jairaj, this is about -20 degrees. For you it will be different. Then, using a program, crop a square chunk out of the image. Save it to disk with the name “HW01_Dynamic_<your_firstname>_<your_lastname>.jpg”. ( use imwrite() ).
Put a copy of your result into your *.pdf writeup.
(continued…)
6. (2) You are provided with an image called ‘Kitchen_Kolors_4670_ss.jpg’.
This is a sub-sampled version of the original image, hence the ss in the name. Write a program which:
Display the image such that there are only two levels of each channel possible. Here we might as well use im2double, because math will happen on the file: For example…
im_in_rgb = im2double( imread(‘ input_file’… ) );
[ im_blu, im_grn, im_red ] = imsplit( im_in_rgb );
im_new_part_a = im_in_rgb, such that the input values in the range [0, to 0.5) maps to 0,
and input values in the range [0.5,1.0] maps to 1.0.
After you do that, all the values for each pixel are either 0 or 1.
Answer the question: What code did you use to convert this image to get just two levels?
Display this image in your write-up.
b. Convert the input image so that there are only 4 values for each pixel, in each channel. Something like:
im_new_part_b = round( im_in * 4 ) / 4.0;
Answer the questions:
What code did you use to convert this image to get just four levels? Does this image look better or worse than the image in part a?
c. Convert the input image so that there are only 6 values for each pixel, in each channel. Something like:
im_new_part_c = round( im_in * 6 ) / 6.0; % This is not right.
Answer the questions:
What code did you use to convert this image to get just six levels?
Does this image look better or worse than the image in part b?
d. Color Quantization:
Convert this image into an indexed, or palette, image.
[im_palette, my_palette] = rgb2ind( im_new_part_c, 256, ‘nodither’ );
Answer the questions:
If each color channel has six values, how many possible colors are there in the image?
For the resulting set of colors, how many colors were actually found and selected in my_palette? (continued…)
7. (2) Plotting:
You can create other functions by adding up a mixture of sine and/or cosine waves. Compute the following:
x = 0 : 1200; % degrees.
y = the sin of x; (Use sind( ) not sin. )
To this add in all of the odd values up to 101:
for odd_idx = 3 : 2: 101
y = y + (1/odd_idx) * sind( odd_idx * x );
end
plot( x, y, … )
Use a blue line.
Make the axis tight.
Label the x axis:
Label the y axis:
(“axis tight”)
xlabel('Degrees',
ylabel(‘Sum of Sine Waves’,
'Fontsize', 18 );
‘FontSize’, 18 );
Save the plot to a file, and put that plot into your PDF write-up. You can use the “Save Figure” menu option on the figure, or the “save_curr_fig_to_file( )” function that you are given.
8. (1) Always put in a conclusion.
Write at least two paragraphs about what you learned in the homework. What did you do?
What was challenging? What surprised you?
(Paragraphs are separated by a blank line, and are more than two sentences long.)