Effacer les filtres
Effacer les filtres

How to retrieve specific pixels from an image based on the label

1 vue (au cours des 30 derniers jours)
Patrice Gaofei
Patrice Gaofei le 1 Jan 2021
Hello everyone,
I am conducting some works on image restoration, particularly on specular reflection removal. I have obtained some results and I would like to evaluate the performance of my method using some quantitative metrics suh PSNR, SSIM, COV, etc. However, I would like to compute these metrics only for the regions that have restored. Please, how can I retrieve only the pixels of the restored regions from the processed images? This is the code I wrote for computing the evaluation metrics for the entire image.
allPSNR = zeros(1, numImages);
allSSIM = zeros(1, numImages);
for k = 1 : numImages
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
baseFileName1 = theFiles1(k).name;
fullFileName1 = fullfile(theFiles1(k).folder, baseFileName1);
lab = imread(fullFileName);
img = imread(fullFileName1);
allPSNR(k) = psnr(img, lab);
allSSIM(k) = ssim(img, lab);
end
meanPSNR = mean(allPSNR);
meanSSIM = mean(allSSIM);
  3 commentaires
Patrice Gaofei
Patrice Gaofei le 1 Jan 2021
Thank you for your comments. Yes, I do have the binary image that will help map out the regions. That is what I call label.
Patrice Gaofei
Patrice Gaofei le 1 Jan 2021
Please Mr./Mrs. Image Analyst, any hep?

Connectez-vous pour commenter.

Réponse acceptée

Image Analyst
Image Analyst le 1 Jan 2021
See if it will work for one-dimensional vectors:
allPSNR(k) = psnr(img(binaryImage), lab(binaryImage));
allSSIM(k) = ssim(img(binaryImage), lab(binaryImage));
  6 commentaires
Image Analyst
Image Analyst le 2 Jan 2021
Of course pixel values at different locations can be equal. What if you had a completely uniform image where every single pixel in the entire image had the same gray scale value or RGB color? Maybe I'm not understanding what you're trying to say.
Patrice Gaofei
Patrice Gaofei le 3 Jan 2021
Ok Sir/Madam! Thank you very much for the clarification.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by