Read nth image from a folder and compare it with nth image from different folders and store the result
1 次查看(过去 30 天)
显示 更早的评论
So i have 3 folders say F1,F2,F3. Each folder contains images. i.e F1 conatins a1, a2,...; F2= b1,b2,....; F3=c1,c2,....; I want to read image (a1,b1) ,do some operation and store the value in a text file or a m x n table preferably. Similarly i want to read (a2,b2) , (a3, b3) and so on and do the same operation and update the text file. I want to repeat the same thing for (a1, c1), (a2, c2),etc and store it in another file/table. How do i do that?
The names of the files are not simply a1, b1, etc they are very randomly named so the program should read the nth file from F1,nth file from F2 and nth file from F3.
1 个评论
Image Analyst
2022-11-28
If they are randomly names how do you know if "fkjsalf.png" from F1 matches up with "eiruwoeiru.PNG" from F2 or 'xcvnxc.PNG" from F2? How do you plan on associating a given file from F1 with the right corresponding file from F2, F3, etc.if their names are all different????
Also even if the names are the same in two folders, it's not guaranteed that the operating system will say the 3rd file from each folder has the same names. The orders may be different even if all the names are the same.
回答(1 个)
David Hill
2022-11-28
a=dir('F1/');b=dir('F2/');c=dir('F3/');
for k=1:length(a.name)
i1=imread([a(k).folder,'/',a(k).name]);
i2=imread([b(k).folder,'/',b(k).name]);
%do some stuff
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Import, Export, and Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!