Histogram method

조회 수: 7 (최근 30일)
Padma
Padma 2011년 10월 6일
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
UJJWAL
UJJWAL 2011년 10월 6일
What is ur exact question. Please be precise so that we can help better.
UJJWAL
Padma
Padma 2011년 10월 6일
i have a few images and i have to perform histogram on them to find out which image perfectly matches with the query image.so how do i go about it?

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
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
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.
Padma
Padma 2011년 10월 8일
ya,all images are of different sizes.so this method has worked pretty fine.i got zero error for two similar images.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
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?

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by