to search fractal dimension

4 views (last 30 days)
Frisda Sianipar on 13 Mar 2021
Commented: Walter Roberson on 18 Mar 2021
This is already the segmentation stage, and I want to find the fractal dimension but it has an error. Can someone help me?
image_folder = 'F:\kuliah\semester6\TA2\mencoba\output';
outfolder = 'F:\kuliah\semester6\TA2\mencoba\hasil';
if ~isdir(outfolder); mkdir(outfolder); end
files = dir(fullfile(image_folder, '*.jpg'));
%I presume it has the variable map in it
for iFiles = 1:numel(files)
thisfilename = fullfile(files(iFiles).folder,files(iFiles).name);
[~, basename, ext] = fileparts(image_folder);
%change to grayscale
grayimg = rgb2gray(citra);
figure, fig2=imshow(grayimg);
%change to green channel
green_channel = citra(:,:,2);
figure, fig3=imshow(green_channel);
%change to CLAHE (Contrast Limited Adaptive Histogram Equalization)
figure, fig4=imshow(CLAHE);
ER = edge(CLAHE, 'canny');
EG = edge(CLAHE, 'canny');
EB = edge(CLAHE, 'canny');
anyedge = ER | EG | EB;
figure, fig5=imshow(anyedge)
size(fig5)
fig = figure;
outfile = fullfile(outfolder, sprintf('%s-coba-%03d.jpg', basename, iFiles));
saveas(fig5, outfile);
% yang dihitung dimensinya yaitu citra hasil segmentasi
[n, r] = fboxcount(figure,'slope');
%Perhitungan dimensi
df = -diff(log(n))./diff(log(r));
%Menampilkan hasil dimensi
disp(['Df= ' num2str(mean(df(4:8)))]);
% % end
end Walter Roberson on 13 Mar 2021
you are passing in something that isn't an rgb image.
Walter Roberson on 18 Mar 2021
Store the following code in the file named box_the_names.m
image_folder = 'F:\kuliah\semester6\TA2\mencoba';
files = dir(fullfile(image_folder, '*.jpg'));
filenames = fullfile({files.folder}, {files.name});
filenames = char(filenames).';
filenames(end+1:ceil(size(filenames,1)/3)*3, :) = ' ';
filenames = rescale(double(filenames), 0, 1, 'InputMin', 32, 'InputMax', 127);
names_cmap = reshape(filenames, 3, []).';
[n, r] = fboxcount(names_cmap,'slope');