Skip to content

ChangeColorTemperature() causes error: operands could not be broadcast together with shapes (32,) (32,3) on official example #850

@joej970

Description

@joej970

imgaug 0.4.0
python 3.11.5

example from: https://imgaug.readthedocs.io/en/latest/source/examples_basics.html

  import numpy as np
  import imgaug as ia
  import imgaug.augmenters as iaa

  ia.seed(1)
  
  # Example batch of images.
  # The array has shape (32, 64, 64, 3) and dtype uint8.
  images = np.array(
      [ia.quokka(size=(64, 64)) for _ in range(32)],
      dtype=np.uint8
  )
  
  seq = iaa.Sequential([
      iaa.Fliplr(0.5), # horizontal flips
      iaa.Crop(percent=(0, 0.1)), # random crops
      iaa.Sometimes(
          0.5,
          iaa.GaussianBlur(sigma=(0, 0.5))
      ),
      iaa.LinearContrast((0.75, 1.5)),
      iaa.AdditiveGaussianNoise(loc=0, scale=(0.0, 0.05*255), per_channel=0.5),
      iaa.Multiply((0.8, 1.2), per_channel=0.2),
      iaa.Affine(
          scale={"x": (0.8, 1.2), "y": (0.8, 1.2)},
          translate_percent={"x": (-0.2, 0.2), "y": (-0.2, 0.2)},
          rotate=(-25, 25),
          shear=(-8, 8)
      ),

      # Adding this throws error: operands could not be broadcast together with shapes (32,) (32,3) 
      iaa.ChangeColorTemperature((5000, 8000))
      # ERROR!!! 

      ], random_order=True) # apply augmenters in random order

images_aug = seq(images=images)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions