You are on page 1of 5

Image Comparison Report

A Processing tool for image comparison


Comparison Process
The user-defined method1 Compare() outlines the stages used to identify the image most
similar to the target image. The comparison methods were chosen to replicate how human
judgment would decide whether the images were similar.
In Stage A, Crop() and ResizeImg() were used to reduce the images to 20x13 pixels.
In Stage B, 3 techniques were implemented to compare the images:
1. CompareBrightness() compared the brightness values of the image pixels and used rootmean-square-deviations as a measure of distance between pixels. Brightness values are
used as people are sensitive to the amount of light and are likely to be used to judge
similarity.
2. CompareLab() converted RGB values to CIELAB values for each image pixel and used
Delta E as a measure of distance between colors (Lindbloom, 2011). CIELAB values are
used as they mimic how human eyes see color, which in turn affects human judgment of
similarity (Wikipedia.org).
3. CompareEdges() located the edges of the images and compared the gradient magnitudes
of the pixels. The root-mean-square-deviations of gradient magnitudes were used as a
measure of distance. The method is based on Canny edge detection, chosen because it is a
widely used technique and useful for handling images with noise (Rashmi et al, 2003).
Edge identification would be a strong predictor of human judgment of similarity between
images as well.
The similarity value generated by each technique produced a figure between 0 and 100. Higher
scores reflect greater similarity, and images that were exactly the same had a score of 100.
In Stage C, DisplaySummary() was used to display the results.

User-defined methods are italicized.

Image Comparison Report

Diagram 1: Summary of Comparison Results

Summary of Results
As depicted in diagram 1, CompareBrightness() found that SKY-16 (score: 82.41%) was most
similar to the target image. CompareLab() and CompareEdges() found that SKY-23 (score:
80.32%) and SKY-3 (score: 30.77%) were the most similar images to the target image
respectively.
ResultsTable() was used to generate results for speed comparisons. It ran image comparisons 10
times each for 40 different image sizes and recorded the speeds and results (see AllResults.xls).
The image sizes ranged from 20x13 pixels to 800x532 pixels. Chart 1 depicts the average time
taken of each technique for different number of pixels. All techniques take longer to complete as
the number of pixels increase, but the increase in CompareLab() and CompareEdges() is much
higher than CompareBrightness(). This is likely due to the higher number of computations
required.
In terms of consistency, CompareBrightness() and CompareLab() identified the same image as
being most similar for images at all sizes, while CompareEdges() was inconsistent, identifying
10 different images. Chart 2 depicts the similarity values of CompareBrightness() and
CompareLab() for the 40 different image sizes. Both techniques scores exhibit the same
behavior: erratic in the beginning, peaking at image sizes 280x186 pixels, 300x199 pixels and
320x212 pixels, and stabilizing at a lower score from 340x226 pixels onwards. CompareEdges()
was discarded from this analysis due to its inconsistent nature at identifying the most similar
image.

Image Comparison Report

Chart 1: Average time taken (milliseconds) vs number of pixels

Chart 2: Similarity scores vs number of pixels

Image Comparison Report

Discussion of Results
CompareBrightness() and CompareLab() were consistent and performed similarly in the tests.
While they identified different images as most similar, it is worth noting that the image rated as
CompareBrightness()s second closest was the image rated by CompareLab() as closest, and vice
versa. The slight differences are likely due to CompareBrightness()s focus on brightness values,
and CompareLab()s focus on how humans perceive color. CompareBrightness() is likely more
useful if the amount of sunlight is more important, and CompareLab() may be more useful if the
color of the sky is more important. Both techniques work well at low resolution levels to identify
the most similar image. If the accuracy of the similarity score is important, an image resolution
of 340x226 pixels can be used to reduce the processing time required.
CompareEdges() was inconsistent in identifying the most similar image and was poor at
identifying edges at low resolutions. Although edge identification improved slightly at higher
resolutions, it was still inconsistent at identifying the most similar image. Edge detection
comparisons are likely more useful when differences between the comparison image and the
target image are small.
Future implementations could improve the results by applying the full Canny edge detection
technique to better identify edges. If edges are reasonably identified, different portions of the
image could be isolated for finer comparison (e.g. between the sky and the buildings).
CompareBrightness() and CompareLab() could also take into account neighbouring pixels (e.g.
through Gaussian blurring) to better reflect how humans judge similarity.

Image Comparison Report

References (Including for code examples)


Easyrgb.com. Color conversion math and formulas. [Online] Available from:
http://www.easyrgb.com/index.php?X=MATH&H=02#text2. [Accessed: 13th Dec 2014].
Image Processing Learning Resources. Gaussian Smoothing. [Online] Available from:
http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm. [Accessed: 13th Dec 2014].
JAIN, R., KASTURI, R. & SCHUNCK, B.G. (1995). Machine Vision. New York: McGrawHill.
LINDBLOOM, B. (2011). Delta E (CIE 1994). [Online] Available from:
http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE94.html. [Accessed: 13th Dec
2014].
SHIFFMAN, D. Convolution. [Online] Available from:
https://processing.org/examples/convolution.html. [Accessed: 13th Dec 2014].
RASHMI, KUMAR, M., SAXENA, R. (2013). Algorithm and Technique on Various Edge
Detection: A Survey. Signal & Image Processing: An International Journal. 4(3). p.65-75.
SAINI, S., KASLIWAL, B. & BHATIA, S. (2013). Comparative Study of Image Edge Detection
Algorithms. [Online] Available from: http://arxiv.org/abs/1311.4963. [Accessed: 13th Dec 2014].
Wikipedia.org. Lab Color Space. [Online] Available from:
http://en.wikipedia.org/wiki/Lab_color_space. [Accessed: 13th Dec 2014].

You might also like