Fractal in matlab and image segmentation

5 Ansichten (letzte 30 Tage)
Rosida Octavia Sitorua
Rosida Octavia Sitorua am 13 Mär. 2021
Kommentiert: Keerthi Reddy am 12 Jul. 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 Kommentar
Keerthi Reddy
Keerthi Reddy am 12 Jul. 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?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Fractals finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by