code: def laplacian_pipe(
      device, window_size, in_type, out_type, normalize, grayscale
  ):
      # use OpenCV convention - window size 1 implies deriv kernel of size 3 and no smoothing
      if window_size == 1:
          window_size, smoothing_size = 3, 1
      else:
          smoothing_size = None
      imgs, _ = fn.readers.file(
          file_root=images_dir, shard_id=0, num_shards=1
      )
      output_type = types.GRAY if grayscale else types.RGB
      imgs = fn.decoders.image(
          imgs, device="cpu", output_type=output_type
      )
      if in_type != types.UINT8:
          imgs = fn.cast(imgs, dtype=in_type)
      if device == "gpu":
          imgs = imgs.gpu()
      if out_type == in_type:
          out_type = None
      edges = fn.laplacian(
          imgs,
          window_size=window_size,
          smoothing_size=smoothing_size,
          normalized_kernel=normalize,
          dtype=out_type,
          device=device,
      )
      return edges, imgs
  
imports: from nvidia.dali.pipeline import pipeline_def
  import nvidia.dali.types
  import nvidia.dali.fn
  import numpy
  import cv2
  from scipy.ndimage import convolve1d, filters
  import os
  from nose_utils import assert_raises
  from nose.plugins.attrib import attr
  from sequences_test_utils import video_suite_helper, ArgCb
  from test_utils import get_dali_extra_path, check_batch, RandomlyShapedDataIterator
label_desc: Use image node_id 4 for calling a global function with example usage: laplacian_pipe(device, window_size, in_type, out_type, normalize, grayscale) and returns: edges,  imgs