Dr Lakaemper,
Please find attached my HW2 solution (please rename the file
into .zip and then unzip it).
The programs that you should run are part1.m and part2.m .
Other two *.m files contain functions.
Query function takes an additional parameter, which is a
cell array with images, and it returns indices to the two most similar images
(not the actual images).
Histogram similarity is based on the norm of histogram
difference. However, before that I apply histogram normalization (so that the
sum of a histogram is always 1) and smoothing (with a sliding window of size 11).
Smoothing eliminates (or decreases) the possibility of situation where two
images that look very similar can have very different histograms, for example
one image is obtained from the other by adding a constant small value to all
RGB values.
I added some comments to the *.m files, but I did that on a
computer with no Image Processing Toolbox, so I cannot test the programs again.
I hope I did not introduce any errors into the source code.
I include 8 images (4 pairs) and a separate database of
images (in ‘source’ folder) that I collected from Wikipedia “Featured
Picture” archive.
When selecting 4 pairs of images, I “cheated” by
using a program that created a pairwise similarity matrix for all images in ‘source’
folder. I selected 4 pairs of images that have the best similarity out of all
pairs. However, it turns out that some of these pairs are also very close to
each other. When running part2.m, for some images the two most similar images
are not from the same pair. Better classes and representatives could be
obtained by using clustering (into 4 clusters), and then selecting representatives
that are closest to the cluster centroids.
Uros Midic
uros@ist.temple.edu
Phone
+215.204.5908
FAX
+215.204.5082
Temple University, 303A Wachman
Hall, 1805 N. Broad St.,
Philadelphia, PA
19122