필터 지우기
필터 지우기

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