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

4 views (last 30 days)
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

Accepted Answer

Walter Roberson
Walter Roberson on 28 Jun 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 Comments
Raza Ali
Raza Ali on 28 Jun 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 on 29 Jun 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

Sign in to comment.

More Answers (0)

Categories

Find more on Read, Write, and Modify Image in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!