フィルターのクリア

image retrieval using Histogram Intersection

1 回表示 (過去 30 日間)
Revathi
Revathi 2013 年 3 月 30 日
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 件のコメント
Walter Roberson
Walter Roberson 2013 年 3 月 30 日
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.

サインインしてコメントする。

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by