Using Confocal algorithm on MATLAB

조회 수: 2 (최근 30일)
Marina Ghobrial
Marina Ghobrial 2021년 12월 10일
편집: Image Analyst 2021년 12월 10일
Hi, I was trying to make a code, where I input a set of images and then I would use confocal algorithm on them. However, I am having errors in the code, Can someone please help?
rootFolder = '/Users/marinaghobrial/Downloads/compressed-2';
%imds=Image2D
imds = imageDatastore (fullfile(rootFolder), ...
'LabelSource',"foldernames", 'IncludeSubfolders',true);
figure
for i = 1:20
subplot(2,2,i);
imshow(imds)
end
I = imread(imds);
PSF = fspecial('gaussian',5,5);
V = 0.002;
blurred_noisy = imnoise(blurred,'gaussian',0,V);
luc1 = deconvlucy(blurred_noisy,PSF,5);
imshow(luc1)
title('I = imread(imds);
PSF = fspecial('gaussian',5,5);
V = 0.002;
blurred_noisy = imnoise(blurred,'gaussian',0,V);
luc1 = deconvlucy(blurred_noisy,PSF,5);
imshow(luc1)
title('Confocalled images')

답변 (1개)

Image Analyst
Image Analyst 2021년 12월 10일
편집: Image Analyst 2021년 12월 10일
This is not correct syntax:
title('I = imread(imds);
You need to have a string in the title argument, like
title('This is my image');
And your display loop needs to be like this:
rootFolder = '/Users/marinaghobrial/Downloads/compressed-2';
imds = imageDatastore (fullfile(rootFolder), ...
'LabelSource',"foldernames", 'IncludeSubfolders',true);
figure
allFileNames = imds.Files;
%allFileNames = allFileNames(1:16); % Show just the first 16.
numImages = length(allFileNames)
plotRows = ceil(sqrt(numImages))
allPossibleFormats = imformats;
validImageCount = 0;
for k = 1:numImages
thisFileName = allFileNames{k};
% Display the file as an image, if you can.
try
thisImage = imread(thisFileName);
validImageCount = validImageCount + 1;
subplot(plotRows, plotRows, validImageCount);
imshow(thisImage)
[folder, baseFileName, ext] = fileparts(thisFileName);
title([baseFileName, ext]);
drawnow;
catch
end
end
g = gcf;
g.WindowState = 'maximized'

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by