code: def _merge_regions(r1, r2):
      new_size = r1["size"] + r2["size"]
      rt = {
          "min_x": min(r1["min_x"], r2["min_x"]),
          "min_y": min(r1["min_y"], r2["min_y"]),
          "max_x": max(r1["max_x"], r2["max_x"]),
          "max_y": max(r1["max_y"], r2["max_y"]),
          "size": new_size,
          "hist_c": (
              r1["hist_c"] * r1["size"] + r2["hist_c"] * r2["size"]
          )
          / new_size,
          "hist_t": (
              r1["hist_t"] * r1["size"] + r2["hist_t"] * r2["size"]
          )
          / new_size,
          "labels": r1["labels"] + r2["labels"],
      }
      return rt
  
imports: import sys
  from past.builtins import cmp
  import skimage.io
  import skimage.feature
  import skimage.color
  import skimage.transform
  import skimage.util
  import skimage.segmentation
  import numpy
label_desc: Use image node_id 12 for calling a global function with example usage: _merge_regions(r1, r2) and returns: rt