Problem with cell array and mat2gray
Show older comments
Hi everyone i have written the next code that reads multiple images whose names start with specific numbers and then does some changes to those images
clc; clear;
outLoopValues = number;
for k = 1 : numel(outLoopValues)
index = outLoopValues(k);
outLoopValues2 = size;
for r = 1 : numel(outLoopValues2)
index2 = outLoopValues2(r);
thisBaseFileName = sprintf('%d.%d0.png', index2, index);
thisFileName = fullfile(folder, thisBaseFileName);
images{index2, index} = imread(sprintf('%d.%d0.png', index2, index));
I1{index2, index} = images{index2, index}(:,:,1);
Icrop{index2, index} = imcrop(I1{index2, index},[1 1 100 100]);
Inew = Icrop(~cellfun('isempty', Icrop));
inpsur1{index2, index}=double(Icrop{index2, index});
Idetrended=mat2gray(inpsur1');
I=uint8(255*Idetrended);
I1=imadjust(I);
I2 = medfilt2(I1,[3 3]);
z=I1;
end
end
but i get the next error:
Error using mat2gray
Expected input number 1, A, to be one of these types:
logical, uint8, uint16, uint32, int8, int16, int32, single, double
Instead its type was cell.
does anyone know how can i fix this?
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!