필터 지우기
필터 지우기

how to find the median of histogram?

조회 수: 10 (최근 30일)
Pradeep Gowda
Pradeep Gowda 2015년 8월 21일
댓글: Image Analyst 2015년 8월 21일
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.

답변 (2개)

Adam
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
Pradeep Gowda
Pradeep Gowda 2015년 8월 21일
편집: Image Analyst 2015년 8월 21일
[x y]=imhist(m);
count=(sum(x(:)))/2;
will his work?
Image Analyst
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
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
Pradeep Gowda
Pradeep Gowda 2015년 8월 21일
i guess this what i needed. One of the sub-images is equalized over the range up to the median and the other sub-image is equalized over the range from the median based on the respective histograms. Thus, the resulting equalized sub-images are bounded by each other around the input median? how do i equalzie them?
Image Analyst
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 CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by