Defining a parameter which depends on image luminance distribution function?

1 回表示 (過去 30 日間)
Johnathon Street
Johnathon Street 2020 年 2 月 14 日
回答済み: Jeff Miller 2020 年 2 月 14 日
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.

回答 (1 件)

Jeff Miller
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

カテゴリ

Help Center および File ExchangeImage Filtering and Enhancement についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by