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!