Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Patrice Gaofei
Patrice Gaofei il 1 Gen 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.

Accedi per commentare.

Risposta accettata

Image Analyst
Image Analyst il 1 Gen 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 Commenti
Image Analyst
Image Analyst il 2 Gen 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 il 3 Gen 2021
Ok Sir/Madam! Thank you very much for the clarification.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by