Azzera filtri
Azzera filtri

image retrieval using Histogram Intersection

1 visualizzazione (ultimi 30 giorni)
Revathi
Revathi il 30 Mar 2013
Hi,
I'm trying to retrieve images using histogram intersection distance measure. When i run the program, i got this error
" Error using ==> imgRetrievalSQRGB at 28 Assertion failed."
Can anyone tell me where have i gone wrong. Here is the code. Thanks.
function rIndex = imgRetrievalSQRGB(img,nRetrievedImgs)
%load histgoram computed in RGB space
trainDB = '.\databaseSQ\';
fname = [trainDB, 'histRGBMat.mat'];
dbRGB = load(fname);
dbRGBMat = dbRGB.histRGBMat;
clear dbRGB;
noRow = size(img,1);
noCol = size(img,2);
imgR = img(:,:,1);
histR = imhist(imgR, 8);
imgG = img(:,:,2);
histG = imhist(imgG, 8);
imgB = img(:,:,3);
histB = imhist(imgB, 4);
histRGB = [histR; histG; histB];
histRGB = histRGB./noRow*noCol;
m=size(histRGB,1); % number of samples of p
p=size(dbRGBMat,2); % dimension of samples
assert(p == size(histRGB,2)); % equal dimensions
assert(size(dbRGBMat,1) == 1); %
hisInterDist=zeros(m,1); % initialize output array
sxi=sum(dbRGBMat);
for i=1:m
hisInterDist(i,1) = 1 - (sum(min(dbRGBMat, histRGB(i,:))) / sxi);
end
[~, indexR] = sort(hisInterDist);
rIndex = indexR(1:nRetrievedImgs);
  1 Commento
Walter Roberson
Walter Roberson il 30 Mar 2013
I recommend using the debugger and putting a breakpoint in at the first assert(), and testing the values to see which constraint is being violated.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by