Fractal in matlab and image segmentation

5 vues (au cours des 30 derniers jours)
Rosida Octavia Sitorua
Rosida Octavia Sitorua le 13 Mar 2021
Commenté : Keerthi Reddy le 12 Juil 2023
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 commentaire
Keerthi Reddy
Keerthi Reddy le 12 Juil 2023
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?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Fractals dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by