how to store and plot values in a loop?
이전 댓글 표시
The code below currently reads in all the jpg images in a file and outputs the average intensity of the imagearray (sum of image matrix), what I am struggling to do, is convert this code so that it measures the intensity of each singular image, stores the value and then plots the change in intensity across all the images.
ImageFolder = 'H:\My Documents\Dissertation';
if ~isfolder(ImageFolder)
ErrorMessage = print('Error: The following folder does not exist: Please specify a new folder.', ImageFolder);
uiwait(warndlg(ErrorMessage));
ImageFolder = uigetdir();
if ImageFolder == 0
return;
end
end
FileType = fullfile(ImageFolder, '*.jpg');
TheImages = dir(FileType);
for k = 1:length(TheImages)
baseFileName = TheImages(k).name;
fullFileName = fullfile(TheImages(k).folder, baseFileName);
if exist(fullFileName,'file')
imageArray = imread(fullFileName);
end
meanIntensity = mean(imageArray(:));
matrix(k) = mean(imageArray(:));
end
plot(k,meanIntensity,'-.x');
hold on
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB Mobile에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!