This project performs simple image compositing and artifact-based color correction using opencv and numpy. It uses PNG input images to isolate and blend foreground and background regions, applying alpha matting logic for compositing.
foreground
-->
alpha * foreground
-->
background
-->
(1-alpha) * background
-->
(1-alpha) * background + alpha * foreground
- Load images (foreground, background, artifact)
- Apply artifact-based color correction (RGB offset)
- Generate alpha matte from artifact image with user specified tolerance
- Composite foreground over background using the matte
- Save the final blended image
artifact Example (the wall behind the robot)
example map of tolerance = 30, if unspesified tolerance = 0

This project requires the following Python libraries:
-
NumPy – Fundamental package for numerical computing
- Website: https://numpy.org/
- Installation:
pip install numpy
-
OpenCV (cv2) – Computer vision and image processing library
- Website: https://opencv.org/
- Installation (prebuilt package):
pip install opencv-python
- Provide images: artifact, foreground, and background.
- Run the program — it will generate a result image using the compositing process where you can save the image to enjoy it.
Developed by Mohammed Yasser Mohammed call me ;)
email : [email protected]





