Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

fitniqe

Fit custom model for NIQE image quality score

Syntax

model = fitniqe(imds)
model = fitniqe(imds,Name,Value)

Description

example

model = fitniqe(imds) creates a Naturalness Image Quality Evaluator (NIQE) model from reference image datastore imds.

example

model = fitniqe(imds,Name,Value) creates a NIQE model using additional parameters to control the model calculation.

Examples

collapse all

Train a custom NIQE model and calculate a NIQE score for a natural image using the trained model.

Train a custom model using natural images stored in an image datastore.

setDir = fullfile(toolboxdir('images'),'imdata');
imds = imageDatastore(setDir,'FileExtensions',{'.jpg'});
model = fitniqe(imds);
Extracting features from 22 images.
.
Completed 3 of 22 images.  Time: Calculating...
..
Completed 6 of 22 images.  Time: 00:23 of 01:30
.
Completed 8 of 22 images.  Time: 00:35 of 01:43

Completed 9 of 22 images.  Time: 00:46 of 02:04
.
Completed 15 of 22 images.  Time: 01:05 of 01:37
...
Done.

Read an image of a natural scene. Display the image.

I = imread('car1.jpg');
imshow(I)

Calculate the NIQE score for the image using the custom model. Display the score.

niqeI = niqe(I,model);
fprintf('NIQE score for the image is %0.4f.\n',niqeI)
NIQE score for the image is 1.7527.

Create a custom NIQE model from a set of natural images. Use the custom model to calculate a NIQE score for a new image.

Load images from an image datastore.

setDir = fullfile(toolboxdir('images'),'imdata');
imds = imageDatastore(setDir,'FileExtensions',{'.jpg'});

Create the custom model of NSS features using the image datastore. Specify a block size and use the default sharpness threshold.

model = fitniqe(imds,'BlockSize',[48 96])
Extracting features from 22 images.
.
Completed 3 of 22 images.  Time: Calculating...
.
Completed 5 of 22 images.  Time: 00:29 of 02:21
.
Completed 7 of 22 images.  Time: 00:39 of 02:09
.
Completed 9 of 22 images.  Time: 00:55 of 02:22
.
Completed 15 of 22 images.  Time: 01:12 of 01:45
...
Done.
model = 
  niqeModel with properties:

                  Mean: [1x36 double]
            Covariance: [36x36 double]
             BlockSize: [48 96]
    SharpnessThreshold: 0

Read a natural image into the workspace. Display the image.

I = imread('yellowlily.jpg');
imshow(I)

Calculate the NIQE score for the image using the custom model. Display the score.

niqeI = niqe(I,model);
fprintf('NIQE score for the image is %0.4f.\n',niqeI)
NIQE score for the image is 3.0885.

Input Arguments

collapse all

Reference image datastore, specified as an ImageDatastore object. Images within the datastore must be real, nonsparse, m-by-n or m-by-n-by-3 matrices of data type single, double, int16, uint8, or uint16.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: model = fitniqe(imds,'BlockSize',[48 36]) fits a NIQE model using 48-by-36 pixel blocks.

collapse all

Block size used to partition the images, specified as the comma-separated pair consisting of 'BlockSize' and a 2-element row vector of positive even integers. Blocks are nonoverlapping. Natural scene statistics, which are calculated from the blocks, define the output model.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Sharpness threshold, specified as the comma-separated pair consisting of 'SharpnessThreshold' and a numeric scalar in the range [0, 1]. The sharpness threshold, s, controls which image blocks are used to compute the model. fitniqe computes the model using all blocks that have sharpness more than s times the maximum sharpness among all blocks.

Data Types: single | double

Output Arguments

collapse all

Custom model of image features, returned as a niqeModel object.

Tips

  • The custom dataset specified in the image datastore imds should consist of images that are perceptually pristine to human subjects. However, the definition of pristine depends on the application. For example, a pristine set of microscopy images has a different set of quality criteria than images of buildings or outdoor scenes. When training a custom NIQE model, use images with varied image content and with potentially different sets of quality criteria.

References

[1] Mittal, A., R. Soundararajan, and A. C. Bovik. "Making a Completely Blind Image Quality Analyzer." IEEE Signal Processing Letters. Vol. 22, Number 3, March 2013, pp. 209–212.

See Also

Functions

Using Objects

Introduced in R2017b

Was this topic helpful?