Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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 Kommentare
Patrice Gaofei
Patrice Gaofei am 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 am 1 Jan. 2021
Please Mr./Mrs. Image Analyst, any hep?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 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 Kommentare
Image Analyst
Image Analyst am 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 am 3 Jan. 2021
Ok Sir/Madam! Thank you very much for the clarification.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by