need to create a loop to load images
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Vinay Anand
el 7 de Sept. de 2019
Editada: KALYAN ACHARJYA
el 11 de Sept. de 2019
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 comentarios
Respuesta aceptada
KALYAN ACHARJYA
el 7 de Sept. de 2019
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 comentarios
KALYAN ACHARJYA
el 10 de Sept. de 2019
Editada: KALYAN ACHARJYA
el 11 de Sept. de 2019
My pleasure Vinay
Más respuestas (1)
Walter Roberson
el 7 de Sept. de 2019
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 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!