Fractal in matlab and image segmentation

조회 수: 1 (최근 30일)
Rosida Octavia Sitorua
Rosida Octavia Sitorua 2021년 3월 13일
댓글: Keerthi Reddy 2023년 7월 12일
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