docstr: Read image by cv2 module.
  
  Args:
      path (str or 'file object'): File path or object to read.
      grayscale (bool):
      size (tupple of int):
          (width, height).
          If None, output img shape depends on the files to read.
      channel_first (bool):
          This argument specifies the shape of img is whether (height, width, channel) or (channel, height, width).
          Default value is False, which means the img shape is (height, width, channel).
      interpolate (str):
          must be one of ["nearest", "bilinear", "bicubic", "lanczos"].
      as_uint16 (bool):
          If True, this function reads image as uint16.
      num_channels (int):
          channel size of output array.
          Default is -1 which preserves raw image shape.
  
  Returns:
      numpy.ndarray
docstr_tok: ["Read","image","by","cv2","module",".","Args",":","path","(","str","or","'file","object","'",")",":","File","path","or","object","to","read",".","grayscale","(","bool",")",":","size","(","tupple","of","int",")",":","(","width",",","height",")",".","If","None",",","output","img","shape","depends","on","the","files","to","read",".","channel_first","(","bool",")",":","This","argument","specifies","the","shape","of","img","is","whether","(","height",",","width",",","channel",")","or","(","channel",",","height",",","width",")",".","Default","value","is","False",",","which","means","the","img","shape","is","(","height",",","width",",","channel",")",".","interpolate","(","str",")",":","must","be","one","of","[","``","nearest","''",",","``","bilinear","''",",","``","bicubic","''",",","``","lanczos","''","]",".","as_uint16","(","bool",")",":","If","True",",","this","function","reads","image","as","uint16",".","num_channels","(","int",")",":","channel","size","of","output","array",".","Default","is","-1","which","preserves","raw","image","shape",".","Returns",":","numpy.ndarray"]
code: def imread(
      self,
      path,
      grayscale=False,
      size=None,
      interpolate="bilinear",
      channel_first=False,
      as_uint16=False,
      num_channels=-1,
  ):
      """
      Read image by cv2 module.
  
      Args:
          path (str or 'file object'): File path or object to read.
          grayscale (bool):
          size (tupple of int):
              (width, height).
              If None, output img shape depends on the files to read.
          channel_first (bool):
              This argument specifies the shape of img is whether (height, width, channel) or (channel, height, width).
              Default value is False, which means the img shape is (height, width, channel).
          interpolate (str):
              must be one of ["nearest", "bilinear", "bicubic", "lanczos"].
          as_uint16 (bool):
              If True, this function reads image as uint16.
          num_channels (int):
              channel size of output array.
              Default is -1 which preserves raw image shape.
  
      Returns:
          numpy.ndarray
      """
  
      _imread_before(grayscale, num_channels)
  
      r_mode = (
          cv2.IMREAD_GRAYSCALE if grayscale else cv2.IMREAD_UNCHANGED
      )
      img = self._imread_helper(path, r_mode)
  
      if as_uint16 and img.dtype != np.uint16:
          if img.dtype == np.uint8:
              logger.warning(
                  "You want to read image as uint16, but the original bit-depth is 8 bit."
                  "All pixel values are simply increased by 256 times."
              )
              img = img.astype(np.uint16) * 256
          else:
              logger.warning(
                  "casting {} to uint16 is not safe.".format(img.dtype)
              )
              return self.next_available(path).imread(
                  path,
                  grayscale=grayscale,
                  size=size,
                  interpolate=interpolate,
                  channel_first=channel_first,
                  as_uint16=as_uint16,
                  num_channels=num_channels,
              )
      try:
          img = self._cvtColor_helper(img, num_channels)
      except:
          return self.next_available(path).imread(
              path,
              grayscale=grayscale,
              size=size,
              interpolate=interpolate,
              channel_first=channel_first,
              as_uint16=as_uint16,
              num_channels=num_channels,
          )
  
      img = _imread_after(
          img, size, interpolate, channel_first, self.imresize
      )
  
      return img
  
file_path: nnabla/python/src/nnabla/utils/image_utils/backend_events/cv2_backend.py
imports: from __future__ import absolute_import, division
  import cv2
  import numpy
  from nnabla.logger import logger
  from .common import upscale_pixel_intensity, check_type_and_cast_if_necessary, _imread_before, _imread_after, _imsave_before, _imresize_before, _imresize_after
  from .image_utils_backend import ImageUtilsBackend
label_desc: Use image node_id 8 for calling the Cv2Backend obj's underlying member method code with example usage: obj.imread(path, grayscale, size, interpolate, channel_first, as_uint16, num_channels) and returns: img, self, self