Images read and comparing with every other images in database

2 views (last 30 days)
I have folder name data and under this folder 40 folders (named A1 to A40) and each one have 10 gray images so total 400 images. I would like to compare each image with other 399 images .I have comparision code.I tried but could not come up with an efficient code. So, could someone please suggest me an idea or code at least how to read those images.

Answers (2)

KALYAN ACHARJYA
KALYAN ACHARJYA on 29 Dec 2017
Edited: KALYAN ACHARJYA on 29 Dec 2017
% Please save all images name in symetric manner before doing the operation
% names for example im1,im2,im3...
% Pls ensure both folder images having equal numbers of images
%Save the folder of images in the current directory
path_directory='optha_original'; % 'Folder name'
% Pls note the format of images,change it as required
original_files=dir([path_directory '/*.jpg']);
l=1;
for k=1:length(original_files)
filename=[path_directory '/' original_files(k).name];
image_orginal=imread(filename);
% Image read is done
%%Following code for Image Call
images_call='images1'; % 'Folder name'
call_files=dir([images_call '/*.gif']); % Alert: Image format
filename=[images_call '/' call_files(l).name];
l=l+1; % This increment for next call images
call_image=imread(filename);
% Now you have two images image_orinal>original image
% and call_image> call image for compare
% Next do your operation and finding
end

KSSV
KSSV on 29 Dec 2017
S = dir ; % get folders in the directory
for i = 3:length(S) % loop for each folder
foldername = S(i).name ;
if S(i).isdir
files = dir('*.png') ; % your image extension
N = length(files) ; % total images
for j = 1:N % loop for each image
imagename = files(j).name ;
I = imread(imagename) ;
end
end
end

Categories

Find more on Convert Image Type in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!