code: def get_fg_mask(bg_color, samples, options):
  
      '''Determine whether each pixel in a set of samples is foreground by
  comparing it to the background color. A pixel is classified as a
  foreground pixel if either its value or saturation differs from the
  background by a threshold.'''
  
      s_bg, v_bg = rgb_to_sv(bg_color)
      s_samples, v_samples = rgb_to_sv(samples)
  
      s_diff = np.abs(s_bg - s_samples)
      v_diff = np.abs(v_bg - v_samples)
  
      return ((v_diff >= options.value_threshold) |
              (s_diff >= options.sat_threshold)f get_fg_mask(bg_color, samples, options):
  
      '''Determine whether each pixel in a set of samples is foreground by
  comparing it to the background color. A pixel is classified as a
  foreground pixel if either its value or saturation differs from the
  background by a threshold.'''
  
      s_bg, v_bg = rgb_to_sv(bg_color)
      s_samples, v_samples = rgb_to_sv(samples)
  
      s_diff = np.abs(s_bg - s_samples)
      v_diff = np.abs(v_bg - v_samples)
  
      return ((v_diff >= options.value_threshold) |
              (s_diff >= options.sat_threshold))
docs: Determine whether each pixel in a set of samples is foreground by
  comparing it to the background color. A pixel is classified as a
  foreground pixel if either its value or saturation differs from the
  background by a threshold.