After PCA, the reconstructed image is darker than the original.
original iris image
pca iris image
After PCA of the iris image, I reconstructed the image and it became dark. And when I analyzed the original image and PCA image with SSIM, the result was 0.09333. Other than that, I tried MSE and PSNR, and all the results showed low structural similarity between images. What part of the code should I modify to solve this problem?
clc; clear;
% Importing an iris image
i_image = ‘홍채 이미지 예시2.jpg’;
i = imread(i_image);
figure(1);
imshow(i);
title(‘Original Image’);
% Image RGB Channel Extraction
red = double(i(:, :, 1));
green = double(i(:, :, 2));
blue = double(i(:, :, 3));
% Specifying the number of principal components
num_components = 200;
% Red Channel PCA
[coeff_r, score_r, ~] = pca(red);
reduced_score_r = score_r(:, 1:num_components);
reconstructed_R = reduced_score_r * coeff_r(:, 1:num_components)’;
% Green Channel PCA
[coeff_g, score_g, ~] = pca(green);
reduced_score_g = score_g(:, 1:num_components);
reconstructed_G = reduced_score_g * coeff_g(:, 1:num_components)’;
% Blue Channel PCA
[coeff_b, score_b, ~] = pca(blue);
reduced_score_b = score_b(:, 1:num_components);
reconstructed_B = reduced_score_b * coeff_b(:, 1:num_components)’;
% Reconfiguring the image
reconstructed_red = reshape(reconstructed_R, size(red));
reconstructed_green = reshape(reconstructed_G, size(green));
reconstructed_blue = reshape(reconstructed_B, size(blue));
reconstructed_image = cat(3, uint8(reconstructed_red), uint8(reconstructed_green), uint8(reconstructed_blue));
% Show Reconfigured Images
figure(4);
imshow(uint8(reconstructed_image));
title(‘PCA Image’);
% SSIM
ssimval=ssim(i, reconstructed_image);
% MSE
err=immse(i, reconstructed_image);
% PSNR
peaksnr=psnr(i, reconstructed_image);original iris image
pca iris image
After PCA of the iris image, I reconstructed the image and it became dark. And when I analyzed the original image and PCA image with SSIM, the result was 0.09333. Other than that, I tried MSE and PSNR, and all the results showed low structural similarity between images. What part of the code should I modify to solve this problem?
clc; clear;
% Importing an iris image
i_image = ‘홍채 이미지 예시2.jpg’;
i = imread(i_image);
figure(1);
imshow(i);
title(‘Original Image’);
% Image RGB Channel Extraction
red = double(i(:, :, 1));
green = double(i(:, :, 2));
blue = double(i(:, :, 3));
% Specifying the number of principal components
num_components = 200;
% Red Channel PCA
[coeff_r, score_r, ~] = pca(red);
reduced_score_r = score_r(:, 1:num_components);
reconstructed_R = reduced_score_r * coeff_r(:, 1:num_components)’;
% Green Channel PCA
[coeff_g, score_g, ~] = pca(green);
reduced_score_g = score_g(:, 1:num_components);
reconstructed_G = reduced_score_g * coeff_g(:, 1:num_components)’;
% Blue Channel PCA
[coeff_b, score_b, ~] = pca(blue);
reduced_score_b = score_b(:, 1:num_components);
reconstructed_B = reduced_score_b * coeff_b(:, 1:num_components)’;
% Reconfiguring the image
reconstructed_red = reshape(reconstructed_R, size(red));
reconstructed_green = reshape(reconstructed_G, size(green));
reconstructed_blue = reshape(reconstructed_B, size(blue));
reconstructed_image = cat(3, uint8(reconstructed_red), uint8(reconstructed_green), uint8(reconstructed_blue));
% Show Reconfigured Images
figure(4);
imshow(uint8(reconstructed_image));
title(‘PCA Image’);
% SSIM
ssimval=ssim(i, reconstructed_image);
% MSE
err=immse(i, reconstructed_image);
% PSNR
peaksnr=psnr(i, reconstructed_image); original iris image
pca iris image
After PCA of the iris image, I reconstructed the image and it became dark. And when I analyzed the original image and PCA image with SSIM, the result was 0.09333. Other than that, I tried MSE and PSNR, and all the results showed low structural similarity between images. What part of the code should I modify to solve this problem?
clc; clear;
% Importing an iris image
i_image = ‘홍채 이미지 예시2.jpg’;
i = imread(i_image);
figure(1);
imshow(i);
title(‘Original Image’);
% Image RGB Channel Extraction
red = double(i(:, :, 1));
green = double(i(:, :, 2));
blue = double(i(:, :, 3));
% Specifying the number of principal components
num_components = 200;
% Red Channel PCA
[coeff_r, score_r, ~] = pca(red);
reduced_score_r = score_r(:, 1:num_components);
reconstructed_R = reduced_score_r * coeff_r(:, 1:num_components)’;
% Green Channel PCA
[coeff_g, score_g, ~] = pca(green);
reduced_score_g = score_g(:, 1:num_components);
reconstructed_G = reduced_score_g * coeff_g(:, 1:num_components)’;
% Blue Channel PCA
[coeff_b, score_b, ~] = pca(blue);
reduced_score_b = score_b(:, 1:num_components);
reconstructed_B = reduced_score_b * coeff_b(:, 1:num_components)’;
% Reconfiguring the image
reconstructed_red = reshape(reconstructed_R, size(red));
reconstructed_green = reshape(reconstructed_G, size(green));
reconstructed_blue = reshape(reconstructed_B, size(blue));
reconstructed_image = cat(3, uint8(reconstructed_red), uint8(reconstructed_green), uint8(reconstructed_blue));
% Show Reconfigured Images
figure(4);
imshow(uint8(reconstructed_image));
title(‘PCA Image’);
% SSIM
ssimval=ssim(i, reconstructed_image);
% MSE
err=immse(i, reconstructed_image);
% PSNR
peaksnr=psnr(i, reconstructed_image); pca, matlab, image MATLAB Answers — New Questions