Borrar filtros
Borrar filtros

How to find PIQE and BRISQUE for 500 images and how to segregate that with the threshold of min, max and median???

3 visualizaciones (últimos 30 días)
  1. how to find BRISQUE (Blind/Referenceless Image Spatial Quality Evaluator) and PIQE (Perception based Image Quality Evaluator) for 500 images in a folder.
  2. how to segregate these images with threshold of minimum, maximum and median values in different folders.
(eg.,

Respuesta aceptada

Vaibhav
Vaibhav el 28 de Sept. de 2023
Hi Vimal,
It is my understanding that clarification is sought concerning the calculation of “PIQE” and “BRISQUE” for 500 images, and subsequently organizing them into various folders.
The below code offers a solution to the question of finding “BRISQUE” and “PIQE” scores for a set of images in a folder. It calculates the quality scores for 100 randomly selected images from the “CIFAR-10” dataset and segregates them into different folders based on the specified thresholds. The “CIFAR-10” dataset used in the code can be replaced by another dataset according to the specific requirements. By adapting the code and replacing the “CIFAR-10” dataset with concerned image dataset, evaluation of the quality of your images and organizing them based on their quality levels can be achieved.
Please find the code for reference below:
% Download and extract the “CIFAR-10” dataset
url = 'https://www.cs.toronto.edu/~kriz/cifar-10-matlab.tar.gz';
downloadFolder = fullfile(tempdir, 'cifar10');
filename = fullfile(downloadFolder, 'cifar-10-matlab.tar.gz');
untar(url, downloadFolder);
% Load the “CIFAR-10” dataset
load(fullfile(downloadFolder, 'cifar-10-batches-mat', 'test_batch.mat'));
% Select images randomly from the dataset
numImages = 100; % Change to 500 if desired
selectedIndices = randperm(size(data, 1), numImages);
% Initialize arrays to store the BRISQUE and PIQE scores
brisqueScores = zeros(numImages, 1);
piqeScores = zeros(numImages, 1);
% Loop through each selected image and calculate the “BRISQUE” and “PIQE” scores
for i = 1:numImages
img = reshape(data(selectedIndices(i), :), 32, 32, 3);
% Calculate BRISQUE score
brisqueScores(i) = brisque(img);
% Calculate “PIQE” score
piqeScores(i) = piqe(img);
end
% Calculate the minimum, maximum, and median values of the “BRISQUE” and “PIQE” scores
minBrisque = min(brisqueScores);
maxBrisque = max(brisqueScores);
medianBrisque = median(brisqueScores);
minPiqe = min(piqeScores);
maxPiqe = max(piqeScores);
medianPiqe = median(piqeScores);
% Create separate folders for images based on the threshold values
outputFolder = pwd; % Use the present working directory
mkdir(outputFolder, 'BelowMinBrisque');
mkdir(outputFolder, 'AboveMaxBrisque');
mkdir(outputFolder, 'BetweenMinMaxBrisque');
mkdir(outputFolder, 'BelowMinPiqe');
mkdir(outputFolder, 'AboveMaxPiqe');
mkdir(outputFolder, 'BetweenMinMaxPiqe');
% Move the images to the appropriate folders based on the threshold values
for i = 1:numImages
img = reshape(data(selectedIndices(i), :), 32, 32, 3);
imgName = sprintf('image%d.jpg', i);
% Move images based on BRISQUE threshold
if brisqueScores(i) < minBrisque
imwrite(img, fullfile(outputFolder, 'BelowMinBrisque', imgName));
elseif brisqueScores(i) > maxBrisque
imwrite(img, fullfile(outputFolder, 'AboveMaxBrisque', imgName));
else
imwrite(img, fullfile(outputFolder, 'BetweenMinMaxBrisque', imgName));
end
% Move images based on PIQE threshold
if piqeScores(i) < minPiqe
imwrite(img, fullfile(outputFolder, 'BelowMinPiqe', imgName));
elseif piqeScores(i) > maxPiqe
imwrite(img, fullfile(outputFolder, 'AboveMaxPiqe', imgName));
else
imwrite(img, fullfile(outputFolder, 'BetweenMinMaxPiqe', imgName));
end
end
Please refer to the following documentations for more information:
Hope this helps!
Regards,
Vaibhav

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by