class_docstr: Apply a convolution to input images.
  
  **Supported dtypes**:
  
      See :func:`~imgaug.augmenters.convolutional.convolve_`.
  
  Parameters
  ----------
  matrix : None or (H, W) ndarray or imgaug.parameters.StochasticParameter or callable, optional
      The weight matrix of the convolution kernel to apply.
  
          * If ``None``, the input images will not be changed.
          * If a 2D numpy array, that array will always be used for all
            images and channels as the kernel.
          * If a callable, that method will be called for each image
            via ``parameter(image, C, random_state)``. The function must
            either return a list of ``C`` matrices (i.e. one per channel)
            or a 2D numpy array (will be used for all channels) or a
            3D ``HxWxC`` numpy array. If a list is returned, each entry may
            be ``None``, which will result in no changes to the respective
            channel.
  
  seed : None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional
      See :func:`~imgaug.augmenters.meta.Augmenter.__init__`.
  
  name : None or str, optional
      See :func:`~imgaug.augmenters.meta.Augmenter.__init__`.
  
  random_state : None or int or imgaug.random.RNG or numpy.random.Generator or numpy.random.BitGenerator or numpy.random.SeedSequence or numpy.random.RandomState, optional
      Old name for parameter `seed`.
      Its usage will not yet cause a deprecation warning,
      but it is still recommended to use `seed` now.
      Outdated since 0.4.0.
  
  deterministic : bool, optional
      Deprecated since 0.4.0.
      See method ``to_deterministic()`` for an alternative and for
      details about what the "deterministic mode" actually does.
  
  Examples
  --------
  >>> import imgaug.augmenters as iaa
  >>> matrix = np.array([[0, -1, 0],
  >>>                    [-1, 4, -1],
  >>>                    [0, -1, 0]])
  >>> aug = iaa.Convolve(matrix=matrix)
  
  Convolves all input images with the kernel shown in the ``matrix``
  variable.
  
  >>> def gen_matrix(image, nb_channels, random_state):
  >>>     matrix_A = np.array([[0, -1, 0],
  >>>                          [-1, 4, -1],
  >>>                          [0, -1, 0]])
  >>>     matrix_B = np.array([[0, 1, 0],
  >>>                          [1, -4, 1],
  >>>                          [0, 1, 0]])
  >>>     if image.shape[0] % 2 == 0:
  >>>         return [matrix_A] * nb_channels
  >>>     else:
  >>>         return [matrix_B] * nb_channels
  >>> aug = iaa.Convolve(matrix=gen_matrix)
  
  Convolves images that have an even height with matrix A and images
  having an odd height with matrix B.
class_docstr_tok: ["Apply","a","convolution","to","input","images",".","*","*","Supported","dtypes","*","*",":","See",":","func",":","`","~imgaug.augmenters.convolutional.convolve_","`",".","Parameters","--","--","--","--","--","matrix",":","None","or","(","H",",","W",")","ndarray","or","imgaug.parameters.StochasticParameter","or","callable",",","optional","The","weight","matrix","of","the","convolution","kernel","to","apply",".","*","If","``","None","``",",","the","input","images","will","not","be","changed",".","*","If","a","2D","numpy","array",",","that","array","will","always","be","used","for","all","images","and","channels","as","the","kernel",".","*","If","a","callable",",","that","method","will","be","called","for","each","image","via","``","parameter","(","image",",","C",",","random_state",")","``",".","The","function","must","either","return","a","list","of","``","C","``","matrices","(","i.e",".","one","per","channel",")","or","a","2D","numpy","array","(","will","be","used","for","all","channels",")","or","a","3D","``","HxWxC","``","numpy","array",".","If","a","list","is","returned",",","each","entry","may","be","``","None","``",",","which","will","result","in","no","changes","to","the","respective","channel",".","seed",":","None","or","int","or","imgaug.random.RNG","or","numpy.random.Generator","or","numpy.random.BitGenerator","or","numpy.random.SeedSequence","or","numpy.random.RandomState",",","optional","See",":","func",":","`","~imgaug.augmenters.meta.Augmenter.__init__","`",".","name",":","None","or","str",",","optional","See",":","func",":","`","~imgaug.augmenters.meta.Augmenter.__init__","`",".","random_state",":","None","or","int","or","imgaug.random.RNG","or","numpy.random.Generator","or","numpy.random.BitGenerator","or","numpy.random.SeedSequence","or","numpy.random.RandomState",",","optional","Old","name","for","parameter","`","seed","`",".","Its","usage","will","not","yet","cause","a","deprecation","warning",",","but","it","is","still","recommended","to","use","`","seed","`","now",".","Outdated","since","0.4.0.","deterministic",":","bool",",","optional","Deprecated","since","0.4.0",".","See","method","``","to_deterministic","(",")","``","for","an","alternative","and","for","details","about","what","the","``","deterministic","mode","''","actually","does",".","Examples","--","--","--","--",">",">",">","import","imgaug.augmenters","as","iaa",">",">",">","matrix","=","np.array","(","[","[","0",",","-1",",","0","]",",",">",">",">","[","-1",",","4",",","-1","]",",",">",">",">","[","0",",","-1",",","0","]","]",")",">",">",">","aug","=","iaa.Convolve","(","matrix=matrix",")","Convolves","all","input","images","with","the","kernel","shown","in","the","``","matrix","``","variable",".",">",">",">","def","gen_matrix","(","image",",","nb_channels",",","random_state",")",":",">",">",">","matrix_A","=","np.array","(","[","[","0",",","-1",",","0","]",",",">",">",">","[","-1",",","4",",","-1","]",",",">",">",">","[","0",",","-1",",","0","]","]",")",">",">",">","matrix_B","=","np.array","(","[","[","0",",","1",",","0","]",",",">",">",">","[","1",",","-4",",","1","]",",",">",">",">","[","0",",","1",",","0","]","]",")",">",">",">","if","image.shape","[","0","]","%","2","==","0",":",">",">",">","return","[","matrix_A","]","*","nb_channels",">",">",">","else",":",">",">",">","return","[","matrix_B","]","*","nb_channels",">",">",">","aug","=","iaa.Convolve","(","matrix=gen_matrix",")","Convolves","images","that","have","an","even","height","with","matrix","A","and","images","having","an","odd","height","with","matrix","B","."]
code: def __init__(
      self,
      matrix=None,
      seed=None,
      name=None,
      random_state="deprecated",
      deterministic="deprecated",
  ):
      super(Convolve, self).__init__(
          seed=seed,
          name=name,
          random_state=random_state,
          deterministic=deterministic,
      )
  
      if matrix is None:
          self.matrix = None
          self.matrix_type = "None"
      elif ia.is_np_array(matrix):
          assert matrix.ndim == 2, (
              "Expected convolution matrix to have exactly two dimensions, "
              "got %d (shape %s)." % (matrix.ndim, matrix.shape)
          )
          self.matrix = matrix
          self.matrix_type = "constant"
      elif ia.is_callable(matrix):
          self.matrix = matrix
          self.matrix_type = "function"
      else:
          raise Exception(
              "Expected float, int, tuple/list with 2 entries or "
              "StochasticParameter. Got %s." % (type(matrix),)
          )
  
imports: from __future__ import print_function, division, absolute_import
  import itertools
  import numpy
  import cv2
  import six.moves
  import imgaug
  from .None import meta
  from ..None import parameters
  from ..None import dtypes
label_desc: Use image node_id 1 to create a new Convolve object from inherited base classes: meta with example: obj = Convolve(matrix, seed, name, random_state, deterministic)