140 likes | 216 Views
Image Similarity. Presented By: Ronak Patel Guided By: Dr. Longin Jan Latecki. Pixel Based Image Similarity.
E N D
Image Similarity Presented By:Ronak Patel Guided By: Dr. Longin Jan Latecki
Pixel Based Image Similarity • Typically, done by computing, for each image, a vector containing the values of an attribute and computing the distance between image feature vectors. Here we have considered the color: Red, Green and Blue. • Color Image is a 3-D Matrix, and we can represent it with three 2-D Matrices: • - Red color intensity for each pixel • - Green color intensity for each pixel • - Blue color intensity for each pixel • We then compare the three matrices with the corresponding matrices of the other image. • Compared using 5 methods, get a similarity measure for the three colors: Red, Green, Blue and all the three. Compare the resulting measure to a similar measure of another image.
Pre-processing • Resize: In order to compare two pictures, we have to have image matrices of same size. • Retrieve the three 2-D matrix for each color from the 3-D image matrix. • Get the vector form for each matrix
Comparison Method I Let f and g be two matrices representing a particular color intensity of an image. A measure of similarity is the Euclidean Distance between two images is: function im_1=scale1(im11d,im21d) im = (im11d - im21d) .* (im11d-im21d); im = sum(im); im_1=sqrt(im); return;
Comparison Method II Let c(a,x,y) be a particular color value of the pixel (x,y) in image ‘a’. The measure of similarity is the Manhattan Distance: function im_2= scale2(im11d,im21d) im_2= sum(abs(im11d - im21d)); return;
Comparison Method III Another measure of similarity is: function im=scale3(im11d,im21d) im = (im11d - im21d) .* (im11d-im21d); im = sum(im); return;
Comparison Method IV We can use statistical mean and variance to add stability to pixel to pixel image difference: function spd = scale4(im11d,im21d) d_abxy=im11d-im21d; if(d_abxy ==0) spd =0; else d_ab=sum(d_abxy)/8960; sd=sum((d_abxy-d_ab).*(d_abxy-ab))/8959; spd=abs(94.657*d_ab/sqrt(sd)); end return;
Comparison Method V Let v(a) be a vector of all c(a,x,y) values assigned to all pixels in the image a. Image similarity can be expressed as normalized inner products of such vectors. Since it yields maximum values for equal frames, a possible disparity measure is: function imd5=scale5(imd11, imd21) imd_dot = imd11 * imd21'; imd_norm = norm(imd11)* norm(imd21); imd5 = 1-(imd_dot/imd_norm); return;
Image Database • Consists of 100 images. • 100 shots taken from four different movies • Images 1-40 : Mr. Bean's Christmas • Images 41-70: Shots from House Tour • Images 71:90: Shots of squares on a desk • Images 91:100: Shots from a Kylie Minogue interview
Results • Input an index no. • Gives me Results, sorted out with the most similar image first. • Outputs a retrieval plot: original image vs sorted result
Results • Method 1 and Method 3, give almost similar results. • Method 2 gives less accurate results than Methods 1 and 2 because these methods seem to amplify the differences. • Method 5 does not give as good results as expected. • Method 4, is the best and gives very good results, close to human perception. It is also similar to the hist-based results. • This is because, in the picture dataset I am working with, there is a lot of pixel-based difference due to the difference in position of the objects due to motion. • Methods 1 and 3 (pixel differences) give good results when there is not much of relative pixel changes.