0
\$\begingroup\$

There are some image quality assessment methods for "no-reference" image quality analysis. Here, I am attempting to calculate the NIQE score and PIQE score for batch of images in Matlab. The file structure of test images and the experimental implementation are listed as below.

  • File structure of test images

    The matlab code .m file is placed in the project root folder and there are multiple folders which is named by its data index number for placing test images. For example, there are 1/1.bmp, 1/2.bmp, 1/3.bmp, ..., 2/1.bmp, 2/2.bmp, ... The results of NIQE score and PIQE score for the same data index are collected in a Excel file. For example, the results of images in folder 1/ are in NIQE_PIQE_1.xlsx.

    - /
      | - NIQEPIQEcalculation.m
      | - 1/
            | - 1.bmp
            | - 2.bmp
            | - 3.bmp
            | - 4.bmp
            ...
    
  • NIQE score and PIQE score calculation (NIQEPIQEcalculation.m):

    VideoLength = 1000;
    
    for DataIndex = 1:10
        Index = zeros(1, VideoLength);
        NIQE_results = zeros(1, VideoLength);
        PIQE_results = zeros(1, VideoLength);
        for i = 1:VideoLength
            Index(i) = i;
            InputFileName = fullfile('.', num2str(DataIndex), [num2str(i), '.bmp']);
            if (~isfile(InputFileName))
                fprintf("file: %s does not exist!\n", InputFileName);
                continue;
            end
            image = imread(InputFileName);
            NIQE_results(i) = niqe(image);
            [PIQE_results(i), activityMask, noticeableArtifactsMask, noiseMask] = piqe(image);
        end
        filename = fullfile('.', ['NIQE_PIQE_', num2str(DataIndex), '.xlsx']);
        writecell({"Index"}, filename, 'Sheet', 1, 'Range', 'A1');            %%  Title
        writecell({"NIQE_results"}, filename, 'Sheet', 1, 'Range', 'B1');      %%  Title
        writecell({"PIQE_results"}, filename, 'Sheet', 1, 'Range', 'C1');      %%  Title
        writematrix(Index', filename, 'Sheet', 1, 'Range', 'A2');
        writematrix(NIQE_results', filename, 'Sheet', 1, 'Range', 'B2');
        writematrix(PIQE_results', filename, 'Sheet', 1, 'Range', 'C2');
    end
    

Test Results

The test result as below is the NIQE values and PIQE values of image frames of Big Buck Bunny video from index 1 to 30.

Index NIQE_results PIQE_results
1 100
2 100
3 100
4 100
5 12.2099094425521 91.8023394419114
6 11.6193285900205 89.3472471350986
7 10.8269712726979 89.5699974060974
8 10.2604598394096 78.2692546063272
9 9.41794970557878 93.1639071925716
10 8.98879911222304 89.6933273345099
11 7.83674635699391 72.1679314095433
12 6.93615995922902 71.1787240352723
13 6.25146723699582 55.5303211057818
14 5.95755729784091 49.3978064822725
15 5.8969449994385 32.1378553044025
16 5.9352387933508 28.0569685896641
17 5.84568114108705 25.2654908924866
18 5.83724662032512 27.3660487930311
19 5.77857438338826 25.3675316576998
20 5.88214805832496 20.2540102673404
21 5.84028592378761 17.7404899333201
22 5.75832883896143 15.3890486272598
23 5.88415908864208 16.7476293145601
24 5.98381170240161 13.8769349316869
25 5.73277852694226 14.4188477587674
26 5.94560227365676 12.3147528349809
27 6.02735742430951 10.2252287321363
28 5.84366191580193 10.1362182789466
29 5.82309621870735 11.37956719739
30 5.86973169314128 12.5193078645003

All suggestions are welcome.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.