neuralib.imglib.array
Image array numpy subclass |
|
Subclass of numpy.ndarray that wraps an image and provides chainable image processing methods |
Image Array
This module defines the ImageArrayWrapper, a subclass of numpy.ndarray that wraps image data and provides chainable image processing methods. It allows you to process images fluently using a series of method calls, and then display or further analyze the results as a standard NumPy array.
Example
from neuralib.imglib.processor import image_array
import matplotlib.pyplot as plt
# Load an image (from a file path or a NumPy array)
img = image_array("path/to/image.jpg")
# Process the image: convert to grayscale, apply Gaussian blur, then perform edge detection.
processed = img.to_gray().gaussian_blur(ksize=[5, 5], sigma_x=2.0, sigma_y=2.0).canny_filter()
# Display the processed image using matplotlib.
plt.imshow(processed, cmap='gray')
plt.title("Processed Image")
plt.show()
Method Reference
Method |
Description |
|---|---|
Converts the image to grayscale. |
|
Flips the image vertically (upside down). |
|
Flips the image horizontally (left-to-right). |
|
Extracts a specified color channel (e.g. ‘r’, ‘g’, or ‘b’) as a grayscale image. |
|
Converts a multi-channel image to a 2D representation (grayscale) with an option to flip vertically. |
|
Applies a Gaussian blur to the image using the specified kernel size and sigma values. |
|
Applies the Canny edge detection algorithm on the grayscale version of the image. |
|
Converts the image to a binary image using thresholding. |
|
Denoises the image using non-local means denoising. |
|
Enhances the image contrast via histogram equalization. |
|
Computes the local maxima on a specified color channel after channel extraction. |