dont match the result histogram equalization function with code

11 ビュー (過去 30 日間)
smn iraq
smn iraq 2017 年 11 月 11 日
コメント済み: smn iraq 2017 年 11 月 13 日
dear sir why the result of code for do histogram equalization not match the result of function (histeq) . please help me

採用された回答

Image Analyst
Image Analyst 2017 年 11 月 11 日
Not sure it matters since histogram equalization is such a lousy processing thing to do that it rarely get used anyway. It gives bad looking images and it's not even needed if you're going to do something like thresholding.
  2 件のコメント
smn iraq
smn iraq 2017 年 11 月 12 日
thank you for answer but i would ask you mean that different not problem because i want used this code in my research instead of function. please help me in this subject.
Image Analyst
Image Analyst 2017 年 11 月 12 日
I have a variety of histogram equalization demos attached. There are a variety of ways to do it depending on how flat you want the final histogram to be. The simple version gives a non-flat histogram and merely reassigns the bins. This is the version you usually see out there, and is the worst, but simplest, method. In general they all give crappy looking images.

サインインしてコメントする。

その他の回答 (1 件)

Jan
Jan 2017 年 11 月 12 日
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 件のコメント
smn iraq
smn iraq 2017 年 11 月 13 日
THANK YOU FOR YOUR ANSWER I SHALL FOLLOW YOUR TIPS

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by