Defining a parameter which depends on image luminance distribution function?
조회 수: 3 (최근 30일)
이전 댓글 표시
I am attempting to perform color image enhancement based on a research article found online. I need to perform a brightness adjustment and need to adjust intensity values of each pixel using a non-linear transfer function which is image dependent on the parameter alpha. The parameter alpha depends on the image luminance cumulative distribution function. Alpha is defined as...
alpha = 0 for L < 50, (L - 50)/110 for 50 <= L <= 160, 1 for L > 160.
L is defined as the intensity level corresponding to image luminance Cumulative Distribution Function equal to 0.1.
According to the research article, if 10% or more of all pixels have intensity lower than 50, alpha = 0, when 90% of all pixels have intensity greater than 160, alpha = 1, and if between 10 - 90% of all grayscale pixels have intensity, alpha = (L-50)/110.
Here is my code where i have attempted this...(B represents the grayscale image)
counts = histcounts(B);
cdf = cumsum(counts)/sum(counts);
if cdf <= 50
alpha = 0;
elseif cdf >= 50 && cdf <= 160
alpha = (cdf - 50)/110;
elseif cdf > 160
alpha = 1;
end
I do not believe this code is doing what I need it to do. Any help would be appreciated. I hope I have provided enough information in my question so that my intentions are clear.
Thank you.
댓글 수: 0
답변 (1개)
Jeff Miller
2020년 2월 14일
If I understand you correctly, I think you want this:
L = quantile(B,0.1);
if L <= 50
alpha = 0;
elseif L >= 50 && L <= 160
alpha = (L - 50)/110;
elseif L > 160
alpha = 1;
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!