code: def test_HWC_image(self):
      # Base table, mapping all values to value+10.
      # For channels C>0 we additionally add +C below.
      table_base = np.mod(np.arange(256) + 10, 256).astype(np.int32)
      nb_channels_lst = [
          2,
          3,
          4,
          5,
          511,
          512,
          513,
          512 * 2 - 1,
          512 * 2,
          512 * 2 + 1,
      ]
  
      for nb_channels in nb_channels_lst:
          # Create channelwise LUT.
          tables = []
          for c in np.arange(nb_channels):
              tables.append(
                  np.mod(table_base + c, 256).astype(np.uint8)
              )
  
          tables_by_type = [
              ("array-1d", table_base.astype(np.uint8)),
              ("array-2d", np.stack(tables, axis=-1)),
              (
                  "array-3d",
                  np.stack(tables, axis=-1).reshape((1, 256, -1)),
              ),
              ("list", tables),
          ]
  
          for subtable_descr, subtable in tables_by_type:
              with self.subTest(
                  nb_channels=nb_channels, table_type=subtable_descr
              ):
                  # Create a normalized lut table, so that we can easily
                  # find the projected value via x,y,c coordinates.
                  # In case of array-1d, all channels are treated the same
                  # way.
                  if subtable_descr == "array-1d":
                      tables_3d = np.stack(
                          [table_base] * nb_channels, axis=-1
                      )
                  else:
                      tables_3d = np.stack(tables, axis=-1).reshape(
                          (256, -1)
                      )
  
                  image = np.int32(
                      [
                          [0, 50, 100, 245, 254, 255],
                          [1, 51, 101, 246, 255, 0],
                      ]
                  )
                  image = image[:, :, np.newaxis]
                  image = np.tile(image, (1, 1, nb_channels))
                  for c in np.arange(nb_channels):
                      image[:, :, c] += c
                  image = np.mod(image, 256).astype(np.uint8)
                  image_orig = np.copy(image)
  
                  image_aug = ia.apply_lut_(image, subtable)
  
                  # Reproduce effect of a LUT mapping on the input
                  # image.
                  expected = np.zeros_like(image_orig)
                  for c in np.arange(nb_channels):
                      for x in np.arange(image.shape[1]):
                          for y in np.arange(image.shape[0]):
                              v = image_orig[y, x, c]
                              v_proj = tables_3d[v, c]
                              expected[y, x, c] = v_proj
  
                  assert np.array_equal(image_aug, expected)
                  if nb_channels < 512:
                      assert image_aug is image
                  assert image_aug.shape == (2, 6, nb_channels)
                  assert image_aug.dtype.name == "uint8"
  
imports: from __future__ import print_function, division, absolute_import
  import time
  import warnings
  import sys
  import matplotlib
  import numpy
  import six.moves
  import cv2
  import imgaug
  from imgaug import dtypes
  import imgaug.random
  from imgaug.testutils import assertWarns
label_desc: Use image node_id 3 for calling the Test_apply_lut_ obj's underlying member method code with example usage: obj.test_HWC_image() without return types