code: def _augment_batch_(self, batch, random_state, parents, hooks):
      if batch.images is None:
          return batch
  
      images = batch.images
  
      if self.dtypes_allowed is not None:
          iadt.gate_dtypes_strs(
              images,
              allowed=self.dtypes_allowed,
              disallowed=self.dtypes_disallowed,
              augmenter=self,
          )
  
      nb_images = len(images)
      rss = random_state.duplicate(1 + nb_images)
      per_channel = self.per_channel.draw_samples(
          (nb_images,), random_state=rss[0]
      )
  
      gen = enumerate(zip(images, per_channel, rss[1:]))
      for i, (image, per_channel_i, rs) in gen:
          nb_channels = 1 if per_channel_i <= 0.5 else image.shape[2]
          # TODO improve efficiency by sampling once
          samples_i = [
              param.draw_samples((nb_channels,), random_state=rs)
              for param in self.params1d
          ]
          if per_channel_i > 0.5:
              input_dtype = image.dtype
              # TODO This was previously a cast of image to float64. Do the
              #      adjust_* functions return float64?
              result = []
              for c in sm.xrange(nb_channels):
                  samples_i_c = [sample_i[c] for sample_i in samples_i]
                  args = tuple([image[..., c]] + samples_i_c)
                  result.append(self.func(*args))
              image_aug = np.stack(result, axis=-1)
              image_aug = image_aug.astype(input_dtype)
          else:
              # don't use something like samples_i[...][0] here, because
              # that returns python scalars and is slightly less accurate
              # than keeping the numpy values
              args = tuple([image] + samples_i)
              image_aug = self.func(*args)
          batch.images[i] = image_aug
      return batch
  
imports: from __future__ import print_function, division, absolute_import
  import numpy
  import six.moves
  import skimage.exposure
  import cv2
  import imgaug
  from imgaug.imgaug import _normalize_cv2_input_arr_
  from .None import meta
  from .None import color
  from ..None import parameters
  from ..None import dtypes
  from ..augmentables.batches import _BatchInAugmentation
label_desc: Use image node_id 2 for calling the _ContrastFuncWrapper obj's underlying member method code with example usage: obj._augment_batch_(batch, random_state, parents, hooks) and returns: batch, batch