code: def uint8sc(im):
      
      im = np.asarray(im)
      immin = im.min()
      immax = im.max()
      imrange = immax - immin
      return cv2.convertScaleAbs(im - immin, alpha=255 / imrange)
docs: Scale the image to uint8
  
      Parameters:
      -----------
      im: 2d array
          The image
  
      Returns:
      --------
      im: 2d array (dtype uint8)
          The scaled image to uint8