code: def _read_image_cv2(file, dtype, color, alpha):
      if color:
          if alpha is None:
              color_option = cv2.IMREAD_COLOR
          else:
              # Images with alpha channel are read as (H, W, 4) by cv2.imread.
              # Images without alpha channel are read as (H, W, 3).
              color_option = cv2.IMREAD_UNCHANGED
      else:
          color_option = cv2.IMREAD_GRAYSCALE
  
      if hasattr(file, "read"):
          b = np.array(bytearray(file.read()))
          img = cv2.imdecode(b, color_option)
      else:
          img = cv2.imread(file, color_option)
  
      if img.ndim == 2:
          # reshape (H, W) -> (1, H, W)
          return img[np.newaxis].astype(dtype)
      else:
          # alpha channel is included
          if img.shape[-1] == 4:
              img = _handle_four_channel_image(img, alpha)
          img = img[:, :, ::-1]  # BGR -> RGB
          img = img.transpose((2, 0, 1))  # HWC -> CHW
      return img.astype(dtype)
  
file_path: chainercv/chainercv/utils/image/read_image.py
imports: from __future__ import division
  import chainer
  import numpy
  from PIL import Image
label_desc: Use image node_id 2 for calling a global function with example usage: _read_image_cv2(file, dtype, color, alpha) and returns: img, img