parse some folders in specific directory within particular names in matlab

2 views (last 30 days)
I've written this code , My problems are: 1- When implement code its only views the value of x and writes only the first image from folder test1 to folder temp or to folder discard . 2- How can I write All images in folder test1 to folder temp or discard . 3- Then if I have folders from test 1 to test n how can I repeat this process for all folders with particular name test(i) in a specific directory D to check every image in test folders and complete remaining procedure? Thanks...
% srcFolders = dir('D:\test*');
for folder = 1:length(srcFolders)
path = strcat('D:\',srcFolder(folder).name);
sear = strcat(path, '\*.bmp');
srcFiles = dir(sear);
for i = 1 : length(srcFiles)
filename = strcat(path,'\',srcFiles(i).name);
Image1= imread(filename);
Image2 = imread('D:\2','jpeg'); % Image 2
x=diff(Image1 - Image2); %display the result to console
if (x >= 0.05)
name1 = strcat('D:\temp2\',srcFiles(i).name);
imwrite(Image1, name1);
disp('Value 111111111111.')
disp(x)
else
name2 = strcat('D:\temp3\',srcFiles(i).name);
imwrite(Image1, name2);
disp('Value 222222222222.')
disp(x)
end
end
end

Answers (0)

Tags

No tags entered yet.

Products

Community Treasure Hunt

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

Start Hunting!