how to find the median of histogram?
12 ビュー (過去 30 日間)
古いコメントを表示
i am trying to implement "Dualistic Sub-Image Histogram Equalisation". where the input image needs to be subdivided into two , based on the median of the image. any suggestion would help me.
0 件のコメント
回答 (2 件)
Adam
2015 年 8 月 21 日
Just sort all the image values and take the central one if you want the median value of an image.
If you want the median value of a histogram then just choose an odd number of bins and take the central one.
2 件のコメント
Image Analyst
2015 年 8 月 21 日
Of course not. The median of the bin counts is not the same as the median of the image gray levels. See my answer.
Image Analyst
2015 年 8 月 21 日
What's wrong with simply using the median() function?
theMedian = median(grayImage(:))
belowMask = grayImage <= theMedian;
aboveMask = grayImage > theMedian;
belowGray = grayImage .* uint8(belowMask);
aboveGray = grayImage .* uint8(aboveMask);
2 件のコメント
Image Analyst
2015 年 8 月 21 日
You can use mat2gray() to scale them each to 0-1.
aboveGray = mat2gray(double(aboveGray));
Multiply by 255 if you need a uint8 image in the range 0-255
aboveGray = uint8(255 * mat2gray(double(aboveGray)));
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!