How to read & display multiple images from multiple folder using for loop ?

4 visualizaciones (últimos 30 días)
I have three folders with 12 image in each folder. to comapre them i need to dispaly all the images across their coresponding predicted and ground truth image. Row 1 consists of 12 original images, Row 2 consists of 12 groung truth iamges and Row 3 consists 12 predicted images.
images = imageDatastore('D:\original images');
GroundT = imageDatastore('D:\ground truth');
Predict = imageDatastore('D:\ predicted');
for i = 1:12
subplot(3,12,i)
imshow(images.Files{i})
hold on
for j=13:24
subplot(3,12,j)
imshow(GroundT.Files{i})
hold on
for k=25:36
subplot(3,12,k)
imshow(Predict.Files{i})
end
end
end

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Jun. de 2021
images = imageDatastore('D:\original images');
GroundT = imageDatastore('D:\ground truth');
Predict = imageDatastore('D:\ predicted');
for i = 1:12
subplot(3,12,i*3-2)
imshow(images.Files{i})
subplot(3,12,i*3-1)
imshow(GroundT.Files{i})
subplot(3,12,i*3)
imshow(Predict.Files{i})
end
  2 comentarios
Raza Ali
Raza Ali el 28 de Jun. de 2021
Thank you for your answer but I need all the images in Row 1, all the groundtruth images in Row 2 and all the coresponding predicted images in Row 3.
Walter Roberson
Walter Roberson el 29 de Jun. de 2021
images = imageDatastore('D:\original images');
GroundT = imageDatastore('D:\ground truth');
Predict = imageDatastore('D:\ predicted');
for i = 1:12
subplot(3,12,i)
imshow(images.Files{i})
subplot(3,12,i+12)
imshow(GroundT.Files{i})
subplot(3,12,i+24)
imshow(Predict.Files{i})
end

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by