Professional Documents
Culture Documents
Question-1 Code:: Name - Bhumika Verma Reg. No. - 19BCE1418 Teacher: Dr. S. Geetha Subject: CBIR LAB (L45+L46)
Question-1 Code:: Name - Bhumika Verma Reg. No. - 19BCE1418 Teacher: Dr. S. Geetha Subject: CBIR LAB (L45+L46)
LAB-5
QUESTION-1
CODE:
% Variables
resultFile = 'rgb_image_features.xlsx';
total_images = 20;
levels = 256;
distance_vector = [1 3];
total_features = 2*levels*size(distance_vector,2);
queryImgFileName = '11.jpg';
queryImgFeatures = imgFeatures(queryImgFileName,distance_vector,levels);
total_solutions = 6;
for d = 1:size(distance_vector, 2)
offset = 256*2*(d-1);
end
end
writematrix(labels, resultFile);
end
% The above matrix can have NaN due to zero counts in queryImgFeatures
CSD = sum(rmmissing(CSD_raw));
end
subplot(3, 3, 2);
imshow(getImgFilePath(queryImgFileName));
title('Query Image');
imshow(getImgFilePath(sprintf('%d.jpg',CSDwithQueryImg(idx, 1))));
end
end
if nargin == 2
levels = 256;
end
filePath = getImgFilePath(fileName);
img = imread(filePath);
img = im2gray(img);
for d = 1:size(distance_vector, 2)
end
if nargin == 2
levels = 256;
end
[Y, X] = size(img);
% Image quantization
for r = 1:Y
for c = 1:X
for d = 1:num_of_distances
D = distances(d);
horizontal_count(value+1, d) = horizontal_count(value+1, d) + 1;
end
vertical_count(value+1, d) = vertical_count(value+1, d) + 1;
end
end
end
end
end
OUTPUT:
QUESTION 2:
CODE :
% Start stopwatch
tic
% Variables
resultFile = 'rgb_image_features.xlsx';
total_images = 20;
levels = 256;
distance_vector = [1 3];
total_features = 2*levels*size(distance_vector,2);
dataset = zeros(total_images, total_features+1);
queryImgFileName = '13.jpg';
queryImgFeatures = imgFeatures(queryImgFileName,distance_vector,levels);
CSDwithQueryImg = zeros(total_images, 2);
total_solutions = 6;
img = imread(filePath);
% Convert image to grayscale
% img = im2gray(img);
img = img(:,:,1);
% Use custom auto-correlogram function: acg
[hc, vc] = acg(img, distance_vector, levels);
[Y, X] = size(img);
% Image quantization
img = gray2ind(img, levels);
2)
3)
4)
5)