Sie sind auf Seite 1von 2

Homework 1

ECE 253
Digital Image Processing
October 4, 2015

Instructions :
Homework 1 is due by 11:59 PM, October 13, 2015.
Submit your homework electronically by email to arangesh@ucsd.edu with the subject line
ECE 253 HW1.
The email should have one PDF file of your writeup attached. Make sure it includes your full
name, PID, and email. This file must be named ECE 253 hw1 lastname studentid.pdf.
All problems are to be solved using MATLAB unless mentioned otherwise.
You should avoid using loops in your MATLAB code unless you are explicitly permitted to
do so.
Append source code, floats, matrices, and image outputs, to your writeup where applicable.
Simply pasting your code in the report should suffice, but make sure it is indented correctly.
Problem 1. MATLAB basics

0
3 9 5 1
0
4 25 4 3

(i) Input A =
63 12 23 9 and B = 0
1
6 32 77 0
0
12 8 5 1

1
1
0
1
1

0
1
0
0
0

1
1

1
in MATLAB.
1
0

(ii) Point-wise multiply A with B and set it to C.


(iii) Calculate the inner product of 2nd row and 5th row of C.
(iv) Find the minimum and maximum values and their corresponding row and column indices in
matrix C.

Problem 2. Simple image manipulation


(i) Download any color image from the Internet with a spatial resolution of no more than (720
X 480). Read this image into MATLAB. Call this image A.
1

(ii) Transform the color image to grey-scale. Verify the values are between 0 and 255. If not,
please normalize your image from 0 to 255. Call this image B.
(iii) Add 20 to each value of image B. Set all pixel values greater than 255 to 255. Call this image
C.
(iv) Flip image B along both the horizontal and vertical axis. Call this image D.
(v) Calculate the median of all values in image B. Next, threshold image B by the median value
you just calculated i.e. set all values greater than median to 1 and set all values less than or
equal to the median to 0. Name this binary image E.
Include all images A-E in your report. Try to fit atleast 4 images in a page. You may use the
subplot function if necessary.

Problem 3. Keyboard Conundrum


You are given two images of a laptop keyboard, one of its left section, and the other of its right.
Your job is to horizontally concatenate these perfectly aligned part images into a full image of the
keyboard. However, you notice an overlap of a few columns in both these images which leads to an
undesirable final image. Your job is to write a function with the following specifications:
The function takes in three inputs - filename1, filename2 and ncols. The first two arguments
correspond to the filenames for each image (laptop left.png and laptop right.png) respectively.
The third argument ncols stands for the number of columns that must be discarded from either
the right end of the left image, or the left end of the right image, before concatenating them.
The function has one output: the concatenated final image.
No loops allowed!
In your report, include the final images for both ncols = 0 (direct concatenation), and
ncols = k, where the value k gives you the best final image (without any overlap). Also,
include the value you obtained for k.