How to compare an image with a database of other images through the color histogram in Matlab?
3 views (last 30 days)
Show older comments
Hi there!
So, I'm working in project of data mining, and for the conclusion i need to prove that is possible find similarity in images through a program, using KNN (euclidian distance). I choose Matlab, but i'm don't have any experience in this program, so I would like you guys to help me. The idea is: Compare one new image with a data collection of images, to prove or not the similarity between the image and the database. This is possible because I tought in make a rank of these images and through this rank and return the nearest image(in euclidian distance).
I've this code:
a = imread('c1.jpg');
A = rgb2gray(angel);
b = imread('c2.jpg');
B = rgb2gray(beer);
c = corr2(A,B);
if c==1
disp('The images are same')
else
disp('the images are not same')
end;
This code compare just two images, I can't compare a image with a database, nor with a rank. And the problem is that the image need to be on the same size.
Anyone have I idea about this problem ? It will be very helpful because its a important project. Thanks.
I attached a conceptual model of the process of calculating the similarity between images using color histograms.
0 Comments
Answers (1)
Salman Khan
on 13 Nov 2016
Hey, Gabriel , First of all You need to make the dimensions of your images same i.e 100 x 100 (Dimensions =Rows x columns).. after doing this You need to reshape your database images and query image or images like this.... I=('peppers.png); I=im2double(I); %%%convert uint8 to double in order to process image J=rgb2gray(I); T=reshape[I,[1 , 10000]) where, I = your choosen image or images ... , 1 = your no. of rows(for Making row matrix,we take 1) .. 10000= (your Dimensions=100x100)
After Reshaping the images for both database and query , Use the for Loop for the database images(See Process of concatenating images first in matlab) ...
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!