image retrieval using Histogram Intersection

3 Ansichten (letzte 30 Tage)
Revathi
Revathi am 30 Mär. 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 Kommentar
Walter Roberson
Walter Roberson am 30 Mär. 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by