Fractal in matlab and image segmentation

5 visualizzazioni (ultimi 30 giorni)
Rosida Octavia Sitorua
Rosida Octavia Sitorua il 13 Mar 2021
Commentato: Keerthi Reddy il 12 Lug 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 Commento
Keerthi Reddy
Keerthi Reddy il 12 Lug 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?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Fractals in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by