multilevel thresholding by kapur method
6 views (last 30 days)
Show older comments
whether the below code is correct for multilevel thresholding by kapur method close all clear all I =imread('C:\Users\swathi\Desktop\image1.gif'); level = 4; size(I,3) == 1 [n_countR, x_valueR] = imhist(I(:,:,1)); Nt = size(I,1) * size(I,2); Lmax = 256; for i = 1:Lmax size(I,3) == 1 PI(i) = n_countR(i) / Nt;
end N_PAR = level; dim = N_PAR; m = 256; n = dim; fitR = zeros(1,m); size(I,3) == 1 u = ones(1,dim) * Lmax; l = ones(1,dim); xR = zeros(m,n);
for j = 1: m PI0 = PI(1:xR(j,1)); ind = PI0 == 0; ind = ind .* eps; PI0 = PI0 + ind; clear ind w0 = sum(PI0); H0 = -sum((PI0/w0).*(log2(PI0/w0))); fitR(j) = fitR(j) + H0;
for jl = 2: level
PI0 = PI(xR(j,jl-1)+1:xR(j,jl));
ind = PI0 == 0;
ind = ind .* eps;
PI0 = PI0 + ind;
clear ind
w0 = sum(PI0);
H0 = -sum((PI0/w0).*(log2(PI0/w0)));
fitR(j) = fitR(j) + H0;
end
end
1 Comment
Priyanka Roy
on 1 Dec 2015
Hii, Have you successfully done the multilevel kapur method? I need Multilevel Kapur code for comparative analysis of image with some other multilevel algorithm. Please help me by sending the Multilevel Kapur code.
Thank you.
Answers (1)
LUQMAN HAKIM
on 26 Oct 2022
I need Multilevel thresholding Kapur and Otsu code for my final year project.
I will be glad you mail me the the source code: luqman.skpa@gmail.com
Thank You.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!