A powerful, composable image processing pipeline library for Python that makes working with image filters fun and flexible! π
- π Sequential and parallel image processing pipelines
- π― Easy-to-use filter composition
- π Built-in visualization support
- π‘οΈ Type-safe with Pydantic validation
- π¨ Support for both grayscale and color images
- π Comprehensive processing history tracking
# Basic installation
pip install pixelist
# With visualization support
pip install pixelist[display]
Here's a simple example to get you started:
from pixelist import ImagePipeline, Filter, ProcessingMode
import numpy as np
# Define some filters
@Filter.make
def threshold(image: np.ndarray) -> np.ndarray:
return np.where(image > 127, 255, 0)
@Filter.make
def blur(image: np.ndarray) -> np.ndarray:
return cv2.GaussianBlur(image, (5, 5), 0)
# Create and run a pipeline
pipeline = ImagePipeline([blur, threshold])
results = pipeline.run(
images=your_image,
mode=ProcessingMode.WITH_INTERMEDIATE_SHOW_ALL
)
If you want to experiment with two probable fits in your workflow, make a parallel workflow between those two! Sequential steps after that parallel step would also run on all previous branches without joining the branches. There might be parallel join, or sql like syntax later on for a fine-grain control on batches, but for now, its as simple as that!
# Create parallel branches in your pipeline
pipeline = ImagePipeline([
histogram_stretch,
(prewitt_filter, laplacian_filter) # Parallel filters
])
@Filter.make
def my_awesome_filter(image: np.ndarray) -> np.ndarray:
# Your image processing magic here
return processed_image
The library includes built-in visualization support:
from pixelist import ImagePipeline, ProcessingMode
pipeline.make(
images=input_images, # can be a random sample of your dataset
filters=[
histogram_stretch, # Sequential
(prewitt_filter, laplacian_filter) # Superposition/Parallel, follows to parallel branches
]
mode=ProcessingMode.WITH_INTERMEDIATE_SHOW_ALL # Shows and store all intermediate steps,
)
NO_INTERMEDIATE
: Just the final resultNO_INTERMEDIATE_SHOW_FINAL
: Show final result visuallyWITH_INTERMEDIATE
: Keep all intermediate resultsWITH_INTERMEDIATE_SHOW_ALL
: Visual display of all stepsWITH_INTERMEDIATE_SHOW_FINAL
: Keep all, show final
Final Images are Orange (Leafs of Workflow)
Contributions are welcome! Feel free to:
- Open issues
- Submit PRs
- Suggest improvements
- Share the love β€οΈ
MIT License - feel free to use in your projects!
Special thanks to:
- The NumPy and OpenCV communities
- All our contributors
Made with β€οΈ by the AARMN The Limitless
Remember to β the repo if you like it!