imagenie.grayscale

imagenie.grayscale#

Functions#

grayscale(image)

Converts an image to grayscale.

Module Contents#

imagenie.grayscale.grayscale(image)[source]#

Converts an image to grayscale.

Parameters:#

imagenp.ndarray

The input image, represented as a NumPy array. It can be a 3D array (RGB) or a 2D array (already grayscale).

Returns:#

np.ndarray

The grayscale image as a 2D NumPy array (dtype=uint8).

Raises:#

TypeError

If the input is not a NumPy array.

ValueError

If the input is not a 2D or 3D NumPy array, or if the 3D array does not have 3 channels.