code: def __init__(self, ph, pw, nr_row, nr_col, channel, border, bgcolor):
      self.ph = ph
      self.pw = pw
      self.nr_row = nr_row
      self.nr_col = nr_col
  
      if border is None:
          border = int(0.05 * min(ph, pw))
      self.border = border
  
      if isinstance(bgcolor, int):
          bgchannel = 1
      else:
          bgchannel = 3
      self.bgcolor = bgcolor
      self.channel = max(channel, bgchannel)
  
      self.canvas = np.zeros(
          (
              nr_row * (ph + border) - border,
              nr_col * (pw + border) - border,
              self.channel,
          ),
          dtype="uint8",
      )
  
file_path: tensorpack/tensorpack/utils/viz.py
imports: import numpy
  import os
  import sys
  from ..utils.develop import create_dummy_func
  from .argtools import shape2d
  from .fs import mkdir_p
label_desc: Use image node_id 1 to create a new Canvas object from inherited base classes: object with example: obj = Canvas(ph, pw, nr_row, nr_col, channel, border, bgcolor)