imgcv.quantization.reduce_gray_levels
Functions
|
Check if the input is a numpy array |
|
Reduce the number of gray levels in the input image to desired levels |
Module Contents
- imgcv.quantization.reduce_gray_levels.check_image(image)
Check if the input is a numpy array
- Parameters:
image (np.ndarray) – Input image to be transformed
- Raises:
TypeError – If the input is not a numpy array
ValueError – If the input is not a grayscale or color image
- imgcv.quantization.reduce_gray_levels.reduce_gray_levels(image, k)
Reduce the number of gray levels in the input image to desired levels
- Parameters:
image (np.ndarray) – Input image to be transformed
k (int) – Desired number of bits to represent the image. The number of intensity levels will be 2^k. For example, if k=2, the number of intensity levels will be 4.
- Raises:
TypeError – If the input is not a numpy array
ValueError – If the input is not a grayscale or color image
- Returns:
Image with reduced gray levels
- Return type:
np.ndarray