forked from suuman/selectKeyImagesLines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetImages.m
executable file
·36 lines (29 loc) · 1.15 KB
/
getImages.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
31
32
33
34
35
36
%% By suman raj bista
% function to get name of imagesfiles from folder
function [ListOfImageNames TextFileList] = getImages(folder)
%
global fodseq;
if nargin<1
ImageFolder = cd;
folder = uigetdir(ImageFolder,'Select folder');
end
ImageFolder = folder;
fodseq = upper(folder(end-2:end));
ListOfImageNames = {};
TextFileList = {};
ImageFiles = dir([ImageFolder '/*.*']);
for Index = 1:length(ImageFiles)
baseFileName = ImageFiles(Index).name;
[folder, name, extension] = fileparts(baseFileName);
extension = upper(extension);
switch lower(extension)
case {'.png', '.bmp', '.jpg', '.tif','.jpeg','.pgm','.ppm'}
% Allow only PNG, TIF, JPG, or BMP images
basefilename = ['/' ImageFiles(Index).name];
ListOfImageNames = [ListOfImageNames; strcat(ImageFolder,basefilename)];
case{'.txt'}
basefilename = ['/' ImageFiles(Index).name];
TextFileList = [TextFileList; strcat(ImageFolder,basefilename)];
otherwise
end
end