basicsr.metrics.metric_util

basicsr.metrics.metric_util.reorder_image(img, input_order='HWC')[source]

Reorder images to ‘HWC’ order.

If the input_order is (h, w), return (h, w, 1); If the input_order is (c, h, w), return (h, w, c); If the input_order is (h, w, c), return as it is.

Parameters:
  • img (ndarray) – Input image.

  • input_order (str) – Whether the input order is ‘HWC’ or ‘CHW’. If the input image shape is (h, w), input_order will not have effects. Default: ‘HWC’.

Returns:

reordered image.

Return type:

ndarray

basicsr.metrics.metric_util.to_y_channel(img)[source]

Change to Y channel of YCbCr.

Parameters:

img (ndarray) – Images with range [0, 255].

Returns:

Images with range [0, 255] (float type) without round.

Return type:

(ndarray)