BBHE & DSIHE Algorithms, Apply on PSNR filter.

40 ビュー (過去 30 日間)
Azib Zaheer
Azib Zaheer 2021 年 4 月 20 日
コメント済み: Azib Zaheer 2022 年 5 月 8 日
Apply the following Algorithms on 2 different input images
• Brightness Preserving Bi-Histogram Equalization (BBHE)
• Dualistic Sub Image Histogram Equalization (DSIHE).
Finally, apply the PSNR and compute the results for both histograms in tabular form
  2 件のコメント
Keerthivasan Manavalan
Keerthivasan Manavalan 2022 年 5 月 8 日
Hi I would like to utilize these codes in a survey paper on dark image enhancement Would it be okay if i can cite you and use the same
Azib Zaheer
Azib Zaheer 2022 年 5 月 8 日
yes its okay

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

採用された回答

Azib Zaheer
Azib Zaheer 2021 年 4 月 22 日
Code:
%% Obtain the original image
input_image = imread('abc.jpg');
%% Get histogram of the original image
figure(1)
subplot(3,3,1)
imshow(input_image);
title('ORIGINAL IMAGE')
subplot(3,3,2)
imhist(input_image);
%% BBHE
%% Calculate mean of the histogram
bbhe_mean = round(mean(input_image(:)));
%% Divide the histogram on the basis of the mean in two parts
[H, ~] = imhist(input_image);
H1 = H(1:bbhe_mean);
H2 = H(bbhe_mean+1:256);
%% Equalize each part independently
H1 = H1/sum(H1);
H2 = H2/sum(H2);
%% Combine both sub-images for the processed image
C1 = cumsum(H1);
C2 = cumsum(H2);
C1n = uint8(bbhe_mean * C1);
C2n = uint8(bbhe_mean+1 + (255-bbhe_mean+1)*C2);
img_sum1 = [C1n; C2n];
%% output image of BBHE
figure(1)
subplot(3,3,4)
imshow(intlut(input_image,img_sum1));
title("BBHE IMG")
subplot(3,3,5)
imhist(intlut(input_image,img_sum1));
%% DSIHE
%% Obtain the original image
[X, Y] = size(input_image);
%% Get histogram of the original image
[H, ~] = imhist(input_image);
%% Calculate median of the histogram.
[value, lm] = min (abs(H-(X*Y/2)));
%% Divide the histogram on the basis of the median in two parts.
H1 = H(1:lm);
H2 = H(lm+1:256);
%% Equalize each part independently
H1 = H1/sum(H1);
H2 = H2/sum(H2);
%% Combine both sub-images for the processed image
C1 = cumsum(H1);
C2 = cumsum(H2);
C1n = uint8(lm * C1);
C2n = uint8(lm+1 + (255-lm+1)*C2);
img_sum2 = [C1n; C2n];
%% output image of DSIHE
figure(1)
subplot(3,3,7)
imshow(intlut(input_image,img_sum2));
title("DSIHE IMG")
subplot(3,3,8)
imhist(intlut(input_image,img_sum2));
%% PSNR code
%% For BBHE
P1= psnr(intlut(input_image,img_sum1),input_image);
%% For DSIHE
P2= psnr(intlut(input_image,img_sum2),input_image);
%% Display Results
disp(P1);
disp(P2);
figure(1)
subplot(3,3,6)
title("PSNR= ",P1)
subplot(3,3,9)
title("PSNR= ",P2)

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by