0% found this document useful (0 votes)
49 views2 pages

Homewwork 1

This document outlines two problems for an image processing homework assignment. Problem 1 involves writing two Matlab functions - one using nested loops and one using vectorization without loops - to compute the pairwise Euclidean distances between data points in a matrix. Performance of the two methods should be compared by plotting runtime against data size. Problem 2 involves writing a function to add two images while avoiding saturation and ensuring the output image fits within the dimensions of the inputs, to be tested on sample image files. The report should include algorithms, results, and resources used.

Uploaded by

as.business.023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views2 pages

Homewwork 1

This document outlines two problems for an image processing homework assignment. Problem 1 involves writing two Matlab functions - one using nested loops and one using vectorization without loops - to compute the pairwise Euclidean distances between data points in a matrix. Performance of the two methods should be compared by plotting runtime against data size. Problem 2 involves writing a function to add two images while avoiding saturation and ensuring the output image fits within the dimensions of the inputs, to be tested on sample image files. The report should include algorithms, results, and resources used.

Uploaded by

as.business.023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Image Processing

Homework 1

Problem 1 (20points):
Originally designed by Jane Doe. Given a set of N data, each with D entries, organized
in the form of an N × D matrix,
 
x0,0 x0,1 ··· x0,D−1
 x1,0 x1,1 ··· x1,D−1 
X= .
 
. . ..
 .. .. .. 
. 
xN −1,0 xN −1,1 ··· xN −1,D−1

Each row of X is a horizontal vector →



xi T , in which →

xi is D × 1.
The goal is to compute an N × N matrix, whose entries are the pairwise Euclidean
distance between any two data.
 − →−− →k
kx 0 x 0 k−→−−
x 0
→k
x 1 ··· k−
→−−
x 0 x− −→ 
N −1 k
 k− → − → k−→−− →k k−
→−− x− −→ 
 x1 − x0 k x 1 x 1 ··· x 1 N −1 k 
Z= .. .. .. .. 
 . . . . 

kx−−→ −
→ −
− x k kx− −→ −

− x k · · · kx −−−→ −x −− −→ k
N −1 0 N −1 1 N −1 N −1

You need to implement two Matlab functions:

1. The first one, uses a two level nested loop, iterating through all pairs (i, j) and
compute the corresponding entry Zi,j .
2. The second one, compute Z without any loop, but use basic matrix operations,
including element-wise operations. This is vectorization. You are not allowed to
use any build-in functions, such as plist() and squareform(), for this job.

Generate random matrices of various sizes and profile the performance as plots of
data size v.s. execution time (see CompareEntropyFig.pdf for an example). The x-axis
shows the control variable in the experiment, and the y-axis shows the results of the
experiments.
Hint:
q q
k→

xi − →xj k = (→
− −
xi − →

xj )T (→

xi − →

xj ) = k→

xi k2 − 2→−
xi T →

xj + k→

xj k2

Think about how to compute each of the three entries (for all (i, j) pairs) from the data
matrix X.
In the report, include the following:
• Your algorithms. The description should be independent of the programming
language (so this is not an explanation of your code). Clearly indicate the di-
mensions of matrices in your work. The dimensions should match!
• Results. The timing plot and the discussion of the plot. What is the control
variable in this experiment? What did you observe? What do you learn from this
observation?

Problem 2 (10 points):


The effect of double exposure can be created by adding two images together. Write
a Matlab function to add two images and produce an output image with the following
constaints:

• The output image has the maximum width and height of input images.
• Resizing of the input images is not allowed.
• Image saturation has to be avoided. Image saturation happens when intensity
values exceeding 255 are truncated.

Test your function with Everest expedition.jpg and Everest kalapatthar.jpg, but your
program should work for images of any sizes, not just the two given test images.
In the report, include the following:
• Your algorithm. The description should be independent of the programming
language (so this is not an explanation of your code).

• Result. The input images, the output image, and the discussion. Does the output
meet your expectation? How did you check the correctness of your work?

To Submit:
• You are highly encouraged to pair up with another student to complete this home-
work.

• At the end of your report, please include a section titled: ”Resources that Helped
Me.”
• Submit one single .zip file (NOT .rar or .tar.gz), containing well-documented
Matlab files (.m) and the report. It is preferred that the file is named ”LastNames-
HW.zip”.

• Only one submission per group, and full names of the members should be in-
cluded in the Comments box of the submission page on Blackboard.

You might also like