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

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 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
```

Here is my try step by step:

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

```
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
```

```
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
```

```
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
```