niqe¶
- class mmedit.evaluation.metrics.niqe.niqe(img, crop_border, input_order='HWC', convert_to='y')[source]¶
Calculate NIQE (Natural Image Quality Evaluator) metric.
Ref: Making a “Completely Blind” Image Quality Analyzer. This implementation could produce almost the same results as the official MATLAB codes: http://live.ece.utexas.edu/research/quality/niqe_release.zip
We use the official params estimated from the pristine dataset. We use the recommended block size (96, 96) without overlaps.
- Parameters
img (np.ndarray) – Input image whose quality needs to be computed. The input image must be in range [0, 255] with float/int type. The input_order of image can be ‘HW’ or ‘HWC’ or ‘CHW’. (BGR order) If the input order is ‘HWC’ or ‘CHW’, it will be converted to gray or Y (of YCbCr) image according to the
convert_to
argument.crop_border (int) – Cropped pixels in each edge of an image. These pixels are not involved in the metric calculation.
input_order (str) – Whether the input order is ‘HW’, ‘HWC’ or ‘CHW’. Default: ‘HWC’.
convert_to (str) – Whether converted to ‘y’ (of MATLAB YCbCr) or ‘gray’. Default: ‘y’.
- Returns
NIQE result.
- Return type
niqe_result (float)