Histogram method
7 次查看(过去 30 天)
显示 更早的评论
hello,i have filtered out images from the database based on global descriptor attributes and now i have to use histogram method on these filtered out images and find out the image which matches exactly with the query image.i have used the following steps:
l=0:16:255;
x_i=imread('peppers.png');
x=double(x_i);
r=x(:,:,1);
n1=histc(r,l);
c_elements1=cumsum(n1);
element1=length(c_elements1)
2 个评论
采纳的回答
Image Analyst
2011-10-6
You could just subtract the histograms and find out which pair gives all zeros. This would work if you knew for a fact in advance that your image was definitely in the first batch of candidate images you pulled out of the database. Be aware though that it's possible, though not very likely, that two different images could have the same histograms. However if you have 256 bins, it's unlikely that each and every one of the 256 bins will have exactly the same count level in it, so it should work pretty well (again assuming your image is definitely in there). Something like
noDifference = sum(hist1-hist2) == 0;
3 个评论
Image Analyst
2011-10-7
If all you want to do is to detect an exact match, it's not necessary to normalize by the number of pixels, or to square the differences. But if the images are of different sizes, or somehow slightly different (e.g. slightly cropped or edited somehow) then that is a good idea. The error in that case should be small but not necessarily exactly zero.
更多回答(1 个)
Walter Roberson
2011-10-6
Are the histograms all exactly the same length? Do they each encompass the same number of values, or does the height of the histogram need to be scaled to reflect different number of sample points? If two histograms are identical except that one sample moved from one bin to the adjacent bin (perhaps due to round-off error), then should those be considered matches or not?
Is the question really about the histograms themselves, or are you interested in the probability that the histogram from one is drawn from the same statistical distribution as the histogram from the other?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!