Example 11.2
clear all;
% input image
a = imread('database image.bmp');
tic
dim = 20; % query image
dim1 = 340; % database image
maxtr=[];maxtg=[];maxtb=[];
% calculating the maximum count for each channel of all the windows of
the scene image%
for i1 = 1:dim:dim1
for i2 = 1:dim:dim1
im1 = imcrop(a,[15 10 dim-1 dim-1]);
im1r =im1(:,:,1); im1g = im1(:,:,2); im1b = im1(:,:,3);
% histogram for red channel%
[count,x6r] = imhist(im1r);
countim1r = count;
%histogram for green channel%
[count,x6g] = imhist(im1g);
countim1g = count;
%histogram for blue channel%
[count,x6b] = imhist(im1b);
countim1b = count;
%maximum count of red channel in each window of the scene image%
mx11r = max(countim1r);
maxt1r = [maxtr;mx11r];
maxtr = maxt1r;
%maximum count of green channel in each window of the scene image%
mx11g = max(countim1g);
maxt1g = [maxtg;mx11g];
maxtg = maxt1g;
% maximum count of blue channel in each window of the scene image%
mx11b = max(countim1b);
maxt1b = [maxtb;mx11b];
maxtb = maxt1b;
end
end