code: def gborders(img, alpha=1.0, sigma=1.0):
      
      # The norm of the gradient.
      gradnorm = gaussian_gradient_magnitude(img, sigma, mode='constant')
      return 1.0/np.sqrt(1.0 + alpha*gradnorm)
docs: Stopping criterion for image borders.