image retrieval using Histogram Intersection
조회 수: 2 (최근 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
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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!