parse some folders in specific directory within particular names in matlab
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!