How to implement plateau limit histogram equalization? [closed]

asked 2019-10-26 15:56:30 -0600

hernancrespo gravatar image

updated 2019-10-26 15:57:13 -0600

Hi everyone, I'm trying to implement this paper using MATLAB: https://ieeexplore.ieee.org/document/...

My results are not bad. But when i created a matrice to see difference between my result and original result, i noticed some differences. I couldn't understand where the problem is.

results

I composed below matrice with:

image_of_dif= zeros(width,height);
for i=1:width
    for j=1:height
        d = input_image(i,j);
        e = original_result(i,j);
        difference = difference + uint64(abs(d-e));
        %i cast it to uint64, because type of difference is also uint64    
        image_of_dif(i,j)= (abs(d-e));           
    end
end

result2

Here is my try step by step:

formula 1

modified_histogram = zeros(1,256); %apply formula
for i=1:256
   modified_histogram(i) = (((log( histogram_of_image(i)+alfa))^beta));
end

formula 2

for i=1:256
if(modified_histogram(i)~=0)
    sum = sum + modified_histogram(i);
    cnt=cnt+1;
    end
end

tcl = sum/cnt;    

clipped_histogram = zeros(1,256);
for i=1:256
    if((modified_histogram(i))>=tcl)
    clipped_histogram(i) = tcl;    
    else 
    clipped_histogram(i) = (modified_histogram(i));   
   end
end

formula3

cdf_clipped = zeros(1,256);
cdf_clipped(1) = clipped_histogram(1);
for i=2:256
     cdf_clipped(i) =  clipped_histogram(i) +  cdf_clipped(i-1);
end

formula 4

value_after_enhancement =  zeros(1,256);
for i=1:256
     value_after_enhancement(i) = floor((255*cdf_clipped(i))/cdf_clipped(255));
end
for i=1:width %insert new values
    for j=1:height
            new_pixel_value = input_image(i,j);
            input_image(i,j) =   value_after_enhancement(new_pixel_value);
    end
end
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2019-10-27 05:04:03.153624

Comments

and how is this related to opencv ? we probably won't and can't solve your matlab problem

berak gravatar imageberak ( 2019-10-27 05:03:41 -0600 )edit