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

조회 수: 4 (최근 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