How to measure the image similarity for noisy image (bad image) from the other set of images (good images)?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a noisy image (blurred or with lots of zeros values ) and I have large set of reconstructed images (good images). I have to select the corresponding best out of the reconstructed images. How do I perform this operation efficiently? What measure will be best way to perform do it? Any suggestion to find the best approx image.
6 comentarios
Respuestas (1)
Image Analyst
el 7 de Sept. de 2021
Try this. Adapt as needed:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
% Specify the folder where the files live.
inputFolder = 'C:\Users\yourUserName\Documents\My Pictures';
outputFolder = 'C:\Users\yourUserName\Documents\My Pictures';
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isfolder(inputFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s\nPlease specify a new folder.', inputFolder);
uiwait(warndlg(errorMessage));
inputFolder = uigetdir(); % Ask for a new one.
if inputFolder == 0
% User clicked Cancel
return;
end
end
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isfolder(outputFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s\nPlease specify a new folder.', outputFolder);
uiwait(warndlg(errorMessage));
outputFolder = uigetdir(); % Ask for a new one.
if outputFolder == 0
% User clicked Cancel
return;
end
end
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(inputFolder, '*.png'); % Change to whatever pattern you need.
theInputFiles = dir(filePattern);
filePattern = fullfile(outputFolder, '*.png'); % Change to whatever pattern you need.
theOutputFiles = dir(filePattern);
% Get the first file in the input folder.
baseInputFileName = theInputFiles(1).name;
fullInputFileName = fullfile(theInputFiles(1).folder, baseInputFileName);
inputImage = imread(fullInputFileName);
for k = 1 : length(theOutputFiles)
baseOutputFileName = theOutputFiles(k).name;
fullOutputFileName = fullfile(theInputFiles(k).folder, baseOutputFileName);
fprintf(1, 'Now comparing %s to %s\n', fullInputFileName, fullOutputFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
imageArray = imread(fullOutputFileName);
imshow(imageArray); % Display image.
drawnow; % Force display to update immediately.
ssimResults(k) = ssim(imageArray, inputImage);
immseResults(k) = immse(imageArray, inputImage);
% psnrResults(k) = psnr(imageArray, inputImage);
end
0 comentarios
Ver también
Categorías
Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!