need to create a loop to load images
3 次查看(过去 30 天)
显示 更早的评论
Hi I tryed creating a loop to compare two images for the data to process the images and to save the output in a file, but the first image gets saved but the loop dosent work from the second image onwards, pls help
this is the error what i found
0 个评论
采纳的回答
KALYAN ACHARJYA
2019-9-7
Assuming, you are trying to compare the images from same folder, suppose image1 and image2, image2 and image 3...so on..
%Save all images name in a sequence manner before doing the operation
% names for example im1,im2,im3..or 1,2,3...so on
%Save the folder of images in the current directory
path_directory='cov_test'; % 'Folder name' having images
original_files=dir([path_directory '/*.jpg']);
%........................................^^ Note on image format
for k=1:length(original_files)-1
filename1=[path_directory '/' original_files(k).name];
image1=imread(filename1);
filename2=[path_directory '/' original_files(k+1).name];
image2=imread(filename2);
%
% Now onwards compare image1 and image2
% Your compare code and result finding
% Save the results as per requirements
end
2 个评论
更多回答(1 个)
Walter Roberson
2019-9-7
string() class was introduced in R2016b. It took a few releases before all of the functions were converted to accept strings as well as character vectors. If you were using somewhere around R2017a or R2017b, you might need to char() the result of your string expression to pass it to imread()
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!