code: def test_augment_images__random_color(self):
      class _Color(iap.StochasticParameter):
          def __init__(self, values):
              super(_Color, self).__init__()
              self.values = values
  
          def _draw_samples(self, size, random_state):
              v = random_state.choice(self.values)
              return np.full(size, v, dtype=np.uint8)
  
      colorizer = iaa.RandomColorsBinaryImageColorizer(
          color_true=_Color([253, 254]), color_false=_Color([1, 2])
      )
  
      image_single_chan = np.uint8(
          [
              [0, 0, 0, 1, 0, 0, 0],
              [0, 0, 0, 1, 0, 0, 0],
              [0, 0, 0, 1, 0, 0, 0],
              [0, 0, 0, 1, 0, 0, 0],
              [0, 1, 1, 1, 0, 0, 0],
          ]
      )
      image = np.tile(
          image_single_chan[:, :, np.newaxis] * 128, (1, 1, 3)
      )
  
      # canny image, looks a bit unintuitive, but is what OpenCV returns
      # can be checked via something like
      # print("canny\n", cv2.Canny(image_single_chan*255, threshold1=100,
      #            threshold2=200,
      #            apertureSize=3,
      #            L2gradient=True))
      image_canny = np.array(
          [
              [0, 0, 1, 0, 1, 0, 0],
              [0, 0, 1, 0, 1, 0, 0],
              [0, 0, 1, 0, 1, 0, 0],
              [0, 0, 1, 0, 1, 0, 0],
              [0, 1, 0, 0, 1, 0, 0],
          ],
          dtype=bool,
      )
  
      seen = {
          (253, 1): False,
          (253, 2): False,
          (254, 1): False,
          (254, 2): False,
      }
      for i in range(100):
          aug = iaa.Canny(
              alpha=1.0,
              hysteresis_thresholds=100,
              sobel_kernel_size=3,
              colorizer=colorizer,
              seed=i,
          )
  
          image_aug = aug.augment_image(image)
          color_true = np.unique(image_aug[image_canny])
          color_false = np.unique(image_aug[~image_canny])
          assert len(color_true) == 1
          assert len(color_false) == 1
          color_true = int(color_true[0])
          color_false = int(color_false[0])
  
          seen[(int(color_true), int(color_false))] = True
          assert len(seen.keys()) == 4
          if all(seen.values()):
              break
      assert np.all(seen.values())
  
imports: from __future__ import print_function, division, absolute_import
  import itertools
  import sys
  import numpy
  import cv2
  from imgaug import augmenters
  from imgaug import parameters
  from imgaug import random
  from imgaug.testutils import reseed, runtest_pickleable_uint8_img, is_parameter_instance, remove_prefetching
label_desc: Use image node_id 10 for calling the TestCanny obj's underlying member method code with example usage: obj.test_augment_images__random_color() and returns: np