to search fractal dimension

3 次查看(过去 30 天)
This is already the segmentation stage, and I want to find the fractal dimension but it has an error. Can someone help me?
image_folder = 'F:\kuliah\semester6\TA2\mencoba\output';
outfolder = 'F:\kuliah\semester6\TA2\mencoba\hasil';
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

采纳的回答

Walter Roberson
Walter Roberson 2021-3-13
you are passing in something that isn't an rgb image.
  18 个评论
Frisda Sianipar
Frisda Sianipar 2021-3-17
So the code above and below is combined, sir?
Walter Roberson
Walter Roberson 2021-3-18
Store the following code in the file named box_the_names.m
image_folder = 'F:\kuliah\semester6\TA2\mencoba';
files = dir(fullfile(image_folder, '*.jpg'));
filenames = fullfile({files.folder}, {files.name});
filenames = char(filenames).';
filenames(end+1:ceil(size(filenames,1)/3)*3, :) = ' ';
filenames = rescale(double(filenames), 0, 1, 'InputMin', 32, 'InputMax', 127);
names_cmap = reshape(filenames, 3, []).';
[n, r] = fboxcount(names_cmap,'slope');
and use your existing fboxcount.

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by