필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

how to use for loop for displaying a set of images in same figure

조회 수: 1 (최근 30일)
Pravita Lekshmanan
Pravita Lekshmanan 2019년 3월 27일
마감: MATLAB Answer Bot 2021년 8월 20일
How to display many images using subplot in for loop
clear all;
close all;
%Load the folder in which input images exists
myfile=dir('E:\dataset\Input_images\*.jpg');
%Counts the number of files
numFiles = length(myfile)
numRows = ceil(sqrt(numFiles))
%Load the folder in which ground truth images exists
myfile1=dir('E:\dataset\GT\*.png');
%Counts the number of files
numFiles1 = length(myfile1)
numRows1 = ceil(sqrt(numFiles1))
figure;
for k = 1 : numFiles
for j = 1 : numFiles1
thisFileName = fullfile(myfile(k).folder, myfile(k).name);
thisImage = imread(thisFileName);
grey=rgb2gray(thisImage);
thisFileName1 = fullfile(myfile1(k).folder, myfile1(k).name);
thisImage1 = imread(thisFileName1);
if (numRows == numRows1)
%Segmentation of the image
seg = imsubtract(thisImage1,grey);
subplot(2,4,k);
imshow(seg,[]);
drawnow;
end
end
end
  댓글 수: 1
KSSV
KSSV 2019년 3월 27일
What problem you have with given code?

답변 (0개)

이 질문은 마감되었습니다.

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by