This is a Python library for performing common image processing operations such as brightness adjustment, contrast adjustment, blurring, and image combination.
- Brightness Adjustment: Adjust the brightness of an image by scaling the pixel intensities.
- Contrast Adjustment: Adjust the contrast of an image relative to a specified midpoint.
- Blurring: Apply a box filter blur to an image with proper edge handling.
- Kernel Application: Apply a custom convolution kernel to an image with improved edge handling.
- Image Combination: Combine two images using various methods (root sum of squares, addition, multiplication, maximum).
- Utility Functions: Create Gaussian and edge detection kernels.
To use this library, you'll need to have the following dependencies installed:
- NumPy
You can install the dependencies using pip:
pip install numpy
Here's an example of how to use the library:
from image import Image
from image_processing import brighten, adjust_contrast, blur, apply_kernel, combine_images
# Load an image
image = Image(filename='example.jpg')
# Brighten the image
brightened_image = brighten(image, factor=1.5)
# Adjust the contrast
contrast_adjusted_image = adjust_contrast(image, factor=2.0, mid=0.5)
# Apply a Gaussian blur
blurred_image = blur(image, kernel_size=5)
# Apply a custom kernel
edge_kernel = create_edge_kernel('sobel_x')
edged_image = apply_kernel(image, edge_kernel)
# Combine two images
image1 = Image(filename='image1.jpg')
image2 = Image(filename='image2.jpg')
combined_image = combine_images(image1, image2, method='root_sum_square')
Brighten or darken the image by scaling each pixel's intensity.
Adjust contrast relative to a midpoint using vectorized operations.
Blur image using an optimized box filter approach with proper edge handling.
Apply a convolution kernel to the image with improved edge handling.
Combine two images using various methods.
Create a Gaussian kernel for blurring.
Create kernels for edge detection.
If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.