I want to know if we can implement histogram equalization without the histeq function?
이전 댓글 표시
I have a project and I have to implement histogram equalization without using the histeq function anybody have any idea ?
답변 (3개)
Image Analyst
2011년 12월 6일
1 개 추천
Check out my histogram shaping app:
It will give you a perfectly flat histogram, or any other shape you desire. Otherwise you can do the standard, dumb, imperfect method where you use cumsum() but that won't get you a flat histogram, just a stretched-out/redistributed one.
Sean de Wolski
2011년 12월 6일
0 개 추천
Probably worth a read
Jurgen
2012년 11월 15일
4 bit grayscale example:
grayLevels = (0:15);
%Histogram of image, counts per level:
grayHist = [0 0 40 80 45 11 70 0 0 0 0 0 0 0 0 15];
Make new gray value table with formula:
EQfactor = grayLevels(end)/sum(grayHist);
grayEq = round(EQfactor*cumsum(grayHist));
Finished, Use LUT for equalizing; apply like 'grayEq(im + 1)'
-
Extra info: Use LUT to find new histogram without image data
newGray = zeros(1,length(grayLevels)); % New histogram of image
% Bit messy now:
values = grayHist(grayLevels+1);
newGray(unique(grayEq(grayLevels+1)+1)) = [0 values(values>0)];
stem(newGray);figure;stem(grayHist)
댓글 수: 2
Musab Abid
2021년 11월 7일
how can we implement it on a image?
Image Analyst
2021년 11월 7일
@Musab Abid just have grayLevels be your image, like
grayLevels = imread('moon.tif');
카테고리
도움말 센터 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!