code: def edges(
      tens,
      threshold1=None,
      threshold2=None,
      use_median=True,
      sigma=None,
  ):
      if not isinstance(use_median, bool):
          raise ValueError("use_median must be a boolean")
  
      if not isinstance(threshold1, int) or not isinstance(
          threshold2, int
      ):
          raise ValueError("Threshold values must be integers")
  
      if tens is None:
          raise ValueError("Image is of NoneType()")
  
      if not use_median and (threshold1 is None or threshold2 is None):
          raise ValueError("Specify valid threshold values")
  
      if use_median:
          if sigma is None:
              sigma = 0.3
  
          # computes the median of the single channel pixel intensities
          med = median(tens)
  
          # Canny edge detection using the computed mean
          low = int(max(0, (1.0 - sigma) * med))
          up = int(min(255, (1.0 + sigma) * med))
          canny_edges = cv.Canny(tens, low, up)
  
      else:
          canny_edges = cv.Canny(tens, threshold1, threshold2)
  
      return canny_edges
  
file_path: caer/caer/core.py
imports: import cv2
  import numpy
  import gc
  from .path import listdir, join
label_desc: Use image node_id 9 for calling a global function with example usage: edges(tens, threshold1, threshold2, use_median, sigma) and returns: canny_edges