how to repair the error of read multiple images in one folder and proceed directly to the background removal stage and generate fractal dimension values from those images
2 次查看(过去 30 天)
显示 更早的评论
%-Read Folder
clc;
clear all;
image_folder = 'F:\kuliah\semester6\TA2\Implemen';
filenames = dir (fullfile(image_folder, '*.jpg'));
total_images = numel(filenames);
for n = 1:total_images
f = fullfile(image_folder, filenames(n) .name);
our_images = f;
figure (n)
imshow(our_images)
end
%-Remove Background
citra= our_images ;
% figure, fig1=imshow(citra);
load mri
V = squeeze(citra);
citra3=montage(reshape(V,size(citra)),map,'Indices',3);
saveas(citra3,our_images);
% To search fractal dimension
citra4= our_images;
figure, fig1=imshow(citra4);
[n, r] = fboxcount(citra4,'slope');
df = -diff(log(n))./diff(log(r));
disp(['Df= ' num2str(mean(df(4:8)))]);
Error
Error using montage
Expected input number 1, I, BW, or RGB, to be one of these types:
uint8, double, uint16, logical, single, int16
Error in montage>parse_inputs (line 239)
validateattributes(I, ...
Error in montage (line 168)
parse_inputs(varargin{:});
Error in penggabungan (line 29)
citra3=montage(reshape(V,size(citra)),map,'Indices',3);
0 个评论
采纳的回答
Image Analyst
2021-2-15
What are you trying to do with loading mri, and with montage? montage wants a variable full of images or image names. What are you doing with the squeeze and reshape?
4 个评论
Image Analyst
2021-2-15
I'm sorry but that makes no sense at all. "mri.mat" is a demo file that ships with MATLAB and doesn't have anything at all to do with your code at all. The variables it loads are not used elsewhere in your code. And having them doesn't have anything at all to do with removing any background.
similarly, to say "montage, squezee and reshape are part of the code load mri" makes no sense at all. Yes they are part of your code but what is your intent with them? Then don't remove background and aren't involved with montaging the images.
If you can't figure out how to use montage(), then try imtile(), but first read the documentation about what kinds of arguments it wants.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!