Shortcuts

caer.transforms

caer.transforms.equalize(img, mask=None, by_channels=True)[source]

Equalize the image histogram.

Parameters
  • img (ndarray) – RGB or grayscale image.

  • mask (ndarray) – An optional mask. If given, only the pixels selected by the mask are included in the analysis. Maybe 1 channel or 3 channel array.

  • by_channels (bool) – If True, use equalization by channels separately, else convert image to YCbCr representation and use equalization by Y channel.

Returns

Equalized image (ndarray)

Examples:

>> img = caer.data.beverages()
>> equalized = caer.equalize(img, mask=None)
>> equalized.shape
(427,640,3)
caer.transforms.posterize(img, bits)[source]

Reduce the number of bits for each color channel in the image.

Parameters
  • img (ndarray) – Image to posterize.

  • bits (int) – Number of high bits. Must be in range [0, 8]

Returns

Image with reduced color channels (ndarray)

Examples:

>> img = caer.data.sunrise()
>> posterized = caer.posterize(img, bits=4)
>> posterized.shape
(427,640,3)
caer.transforms.rotate(img, angle, rotPoint=None)[source]

Rotates an given image by an angle around a particular rotation point (if provided) or centre otherwise.

caer.transforms.solarize(img, threshold=128)[source]

Invert all pixel values above a threshold.

Parameters
  • img (ndarray) – The image to solarize.

  • threshold (int) – All pixels above this grayscale level are inverted.

Returns

Solarized image (ndarray)

Examples:

>> img = caer.data.sunrise()
>> solarized = caer.solarize(img, threshold=128)
>> solarized.shape
(427,640,3)
caer.transforms.translate(image, x, y)[source]

Translates a given image across the x-axis and the y-axis

Parameters
  • x (int) – shifts the image right (positive) or left (negative)

  • y (int) – shifts the image down (positive) or up (negative)

Returns

The translated image

Read the Docs v: stable
Versions
latest
stable
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.