dont match the result histogram equalization function with code
Afficher commentaires plus anciens
dear sir why the result of code for do histogram equalization not match the result of function (histeq) . please help me
Réponse acceptée
Plus de réponses (1)
Jan
le 12 Nov 2017
There could be many reasons. Unfortunately your code does not contain useful comments, such that the intention of the code must be guessed - not useful for a serious research.
Could the result differ from histeq due to the conversion to gray? rgb2gray is not unique, is it?
This is ugly:
sum=0;
for i=1:256
sum= sum +imghis(i);
cdf(i)=sum;
end
Do not use "sum" as name of a variable, because this shadows the builtin function with the same name. What about:
cdf = cumsum(imghis);
One line, much faster, lean and clean.
Redefining "norm" is a bad idea also, see above.
norm(count)=norm(count)/(len-cdfmin);
This is strange: You subtract the minimal value of cdf (which is the first value in every case, because cdf is the cumulative sum of non-negative elements) from the number of pixels of the image. Is this meaningful?
If your need a histogram equilization, use the workign and well tested histeq.
1 commentaire
smn iraq
le 13 Nov 2017
Catégories
En savoir plus sur Histograms dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!