How to apply Cumulative Density Function Formula?

Hi,
I am trying to implement a research paper using MATLAB. i have to to apply this three formula, respectively.
son.pngPDa = zeros(1,256);
for i=1:256
PDa(i) = hCL(i) / (width*height); % width*height = total number of pixels
end
CDa = zeros(1,256); %create CDa in formula
CDa(1) = PDa(1) ;
for i=2:256
CDa(i) = PDa(i) + CDa(i-1);
end
value_after_enhancement = zeros(1,256);
for i=1:256
value_after_enhancement(i) = 255 * CDa(i);
end
But maximum value of CDa is 0.109. So, i see a dark image (maximum pixel value is 3) as a result. I couldn't understand where the problem is in my code. Can you help me, please?

4 件のコメント

Jeff Miller
Jeff Miller 2019 年 10 月 31 日
If CDa is a cumulative density, then CDa(end) should equal 1 (i.e., the PDa values should sum to 1).
Since that is not happening, maybe the problem is with how hCL is computed. What is hCL?
Mustafa Uysal
Mustafa Uysal 2019 年 10 月 31 日
Thanks for answer, here is my previous steps
1.png
modified_histogram = zeros(1,256); %apply formula
for i=1:256
modified_histogram(i) = (((log( histogram_of_image(i)+alfa))^beta));
end
2.png
for i=1:256
if(modified_histogram(i)~=0)
sum = sum + modified_histogram(i);
cnt=cnt+1;
end
end
tcl = sum/cnt;
hCL = zeros(1,256);
for i=1:256
if((modified_histogram(i))>=tcl)
hCL(i) = tcl;
else
hCL(i) = (modified_histogram(i));
end
end
Jeff Miller
Jeff Miller 2019 年 11 月 1 日
Sorry, I cannot understand what you are trying to compute.
Mustafa Uysal
Mustafa Uysal 2019 年 11 月 1 日
Thank you for reply.
I am trying to implement an contrast enhancement algorithm using this paper: Research Paper

サインインしてコメントする。

回答 (0 件)

質問済み:

2019 年 10 月 30 日

コメント済み:

2019 年 11 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by