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

5 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2021-6-28
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 个评论
Raza Ali
Raza Ali 2021-6-28
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 2021-6-29
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Read, Write, and Modify Image 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by