Fractal in matlab and image segmentation

5 次查看(过去 30 天)
Here is segmentation process and at the last i wanna count the fractal dimension of the last figure. But it goes error. Can somebody help me to fix this. Thanks
image_folder = 'C:\Users\ADMIN\Matlab\Implementasi\Week7-1\output';
outfolder = 'C:\Users\ADMIN\Matlab\Implementasi\Week7-1\segmentasi';
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);
citra = imread(thisfilename);
%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)
CLAHE = adapthisteq(green_channel);
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
  1 个评论
Keerthi Reddy
Keerthi Reddy 2023-7-12
Can you please provide the specific error message you are recieving? Also can you please provide which part of the code is causing the error?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Fractals 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by