-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathc.3.8_Image Batch processing.m
30 lines (30 loc) · 1.06 KB
/
c.3.8_Image Batch processing.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
% Read the input images
path='c:\dataset';% Data Directory Path
fileinfo = dir(fullfile(path,'*.jpg')); % Files properties
filesnumber=size(fileinfo); % Number of files
for i = 1 : filesnumber(1,1) % Reading loop as number of files
images{i} = imread(fullfile(path,fileinfo(i).name)); %Creating cell array of "images"
disp(['Loading image No : ' num2str(i) ]); % Reading iterations in the loop as message
end;
%RGB to gray convertion
for i = 1 : filesnumber(1,1)
gray{i}=rgb2gray(images{i});
disp(['To Gray : ' num2str(i) ]);
end;
%Histogram equalization
for i = 1 : filesnumber(1,1)
histequation{i}=histeq(gray{i});
disp(['Hist EQ : ' num2str(i) ]);
end;
%Contrast adjustment
for i = 1 : filesnumber(1,1)
adjusted{i}=imadjust(histequation{i});
disp(['Image Adjust : ' num2str(i) ]);
end;
% Resize the final image size
for i = 1 : filesnumber(1,1)
resized{i}=imresize(adjusted{i}, [128 128]);
disp(['Image Resized : ' num2str(i) ]);
end;
%Display multiple image frames as rectangular montage
montage(resized, 'Size', [10 20]);