imagenie package#
Submodules#
imagenie.augment module#
imagenie.blur module#
- imagenie.blur.blur(image, stdev=1.0)[source]#
Add noise to image using a Gaussian filter.
- Parameters:
image (np.ndarray) –
The input image to be blurred, represented as a NumPy array
or similar format.
stdev (Float) –
Standard deviation for Gaussian/Normal distribution used to
calculate the value of image pixels after filtering. Default is 1.0 for Standard Normal Distribution.
- Returns:
The blurred image as a NumPy array.
- Return type:
np.ndarray
Examples
>>> print(image) [0.10196079, 0.627451 , 0.74509805], [0.11372549, 0.6666667 , 0.78431374], [0.1254902 , 0.7058824 , 0.81960785] >>> blur(image) [0.2991612 , 0.5070358 , 0.66973376], [0.30862695, 0.52062243, 0.6859944 ], [0.31771535, 0.53367144, 0.70153326] >>> print(image2) [0.09803922, 0.5882353 , 0.70980394], [0.1254902 , 0.70980394, 0.8235294 ], [0.1254902 , 0.70980394, 0.8235294 ] >>> blur(image2,stdev=2) [0.49137527, 0.5290323 , 0.56662756], [0.49490717, 0.53276986, 0.5705702 ], [0.4977027 , 0.5357282 , 0.5736908 ]
imagenie.flip module#
- imagenie.flip.flip(image, direction=0)[source]#
Flips an image either horizontally or vertically.
Parameters:#
- imagenp.ndarray
The input image to be flipped, represented as a NumPy array or similar format.
- directionstr, optional
The direction in which to flip the image: - 0: for horizontal flip (default) - 1: vertical flip
Returns:#
- np.ndarray
The flipped image as a NumPy array.
Raises:#
- ValueError
If the specified direction is not 1 or 0. If image exceeds size limits.
Examples:#
Flip an image horizontally: >>> flipped_image = flip_image(image)
Flip an image vertically: >>> flipped_image = flip_image(image, 1)
imagenie.grayscale module#
- 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.
imagenie.imagenie module#
imagenie.scale module#
- imagenie.scale.scale(image, N=None)[source]#
Scale an image file by a factor of N.
- Parameters:
image (np.ndarray) – The input image to be scaled. Must be a NumPy array.
N (float) – An positive float specifying the scaling factor.
- Returns:
The scaled image that is represented as np array.
- Return type:
np.ndarray
Examples
Scale the image 2 times larger. >>> img = scale(image, 2)