This project performs simple image compositing and artifact-based color correction using C++. 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 PNG 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

- stb_image.h and stb_image_write.h for PNG loading/saving
PngImage: Struct to hold image data with width, height, channels, and raw pixel dataCompositing: Main class that handles image loading, matting, color correction, and saving
- Provide PNG images: artifact, foreground, and background.
- Compile and 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





