to search fractal dimension

3 vues (au cours des 30 derniers jours)
Frisda Sianipar
Frisda Sianipar le 13 Mar 2021
Commenté : Walter Roberson le 18 Mar 2021
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

Réponse acceptée

Walter Roberson
Walter Roberson le 13 Mar 2021
you are passing in something that isn't an rgb image.
  18 commentaires
Frisda Sianipar
Frisda Sianipar le 17 Mar 2021
So the code above and below is combined, sir?
Walter Roberson
Walter Roberson le 18 Mar 2021
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Sparse Matrices 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