code: def unsharp_mask(
      image: np.ndarray,
      ksize: int,
      sigma: float = 0.0,
      alpha: float = 0.2,
      threshold: int = 10,
  ):
      blur_fn = _maybe_process_in_chunks(
          cv2.GaussianBlur, ksize=(ksize, ksize), sigmaX=sigma
      )
  
      input_dtype = image.dtype
      if input_dtype == np.uint8:
          image = to_float(image)
      elif input_dtype not in (np.uint8, np.float32):
          raise ValueError(
              "Unexpected dtype {} for UnsharpMask augmentation".format(
                  input_dtype
              )
          )
  
      blur = blur_fn(image)
      residual = image - blur
  
      # Do not sharpen noise
      mask = np.abs(residual) * 255 > threshold
      mask = mask.astype("float32")
  
      sharp = image + alpha * residual
      # Avoid color noise artefacts.
      sharp = np.clip(sharp, 0, 1)
  
      soft_mask = blur_fn(mask)
      output = soft_mask * sharp + (1 - soft_mask) * image
      return from_float(output, dtype=input_dtype)
  
imports: from __future__ import division
  from typing import Optional, Sequence, Union
  from warnings import warn
  import cv2
  import numpy
  import skimage
  from albumentations import random_utils
  from albumentations.augmentations.utils import MAX_VALUES_BY_DTYPE, _maybe_process_in_chunks, clip, clipped, ensure_contiguous, is_grayscale_image, is_rgb_image, non_rgb_warning, preserve_channel_dim, preserve_shape
label_desc: Use image node_id 58 for calling a global function with example usage: unsharp_mask(image, ksize, sigma, alpha, threshold) and returns: from_float