Shortcuts

mmcv.image.adjust_sharpness

mmcv.image.adjust_sharpness(img, factor=1.0, kernel=None)[source]

Adjust image sharpness.

This function controls the sharpness of an image. An enhancement factor of 0.0 gives a blurred image. A factor of 1.0 gives the original image. And a factor of 2.0 gives a sharpened image. It blends the source image and the degenerated mean image:

\[output = img * factor + degenerated * (1 - factor)\]
Parameters
  • img (ndarray) – Image to be sharpened. BGR order.

  • factor (float) – Same as mmcv.adjust_brightness().

  • kernel (np.ndarray, optional) – Filter kernel to be applied on the img to obtain the degenerated img. Defaults to None.

Note

No value sanity check is enforced on the kernel set by users. So with an inappropriate kernel, the adjust_sharpness may fail to perform the function its name indicates but end up performing whatever transform determined by the kernel.

Returns

The sharpened image.

Return type

ndarray