A powerful image and video processing tool that transforms visual content into an artistic stippling effect using dynamically sized white circles on a black background. This application processes images, videos, and live webcam input to create unique artistic renderings where brightness values control the size of circles.
- Multiple Input Types: Process images, videos, or webcam input
- High Performance: Optimized for CPU with batch processing and vectorized operations
- Resolution Control: Automatically resizes large videos to Full HD (1920x1080) while preserving aspect ratio
- Batch Processing: Accelerates video processing by handling multiple frames simultaneously
- Real-time Feedback: Shows processing speed and progress information
- Flexible Output: Choose to save results or just view the processing
- Command-line Interface: Easy to use with customizable parameters
- Python 3.7 or higher
- OpenCV
- NumPy
- Clone this repository:
git clone https://github.com/LeDat98/Circleartify
cd Circleartify
- Install required packages:
pip install opencv-python numpy
The application provides a simple command-line interface with various options:
python artistic_effect.py [input] [options]
Process an image:
python artistic_effect.py image.jpg
Process a video:
python artistic_effect.py video.mp4
Use webcam as input:
python artistic_effect.py webcam
Process an image with a larger window size and display the result:
python artistic_effect.py image.jpg --window-size 10 --show=True
Process a video with custom settings:
python artistic_effect.py video.mp4 --window-size 8 --batch-size 15 --output processed_video.mp4
Process webcam feed without saving:
python artistic_effect.py webcam --save=False
Option | Short | Default | Description |
---|---|---|---|
--output |
-o |
Auto-generated | Output file path |
--window-size |
-w |
5 | Size of the processing window |
--batch-size |
-b |
10 | Number of frames to process at once (videos only) |
--save |
True | Whether to save the output | |
--show |
False | Whether to display processing in real-time |
The algorithm divides the input image or video frame into small square regions (windows) of specified size. For each window:
- It calculates the average brightness of pixels in that window
- Based on this brightness value, it determines a circle radius (brighter regions get larger circles)
- It draws a white circle at the center of each window with the calculated radius
- The collection of these circles forms the final artistic rendering
The processing is optimized using NumPy's vectorized operations and OpenCV's efficient image processing capabilities.
- Batch Processing: Videos with high FPS are processed in batches to improve throughput
- Resize Control: Large videos are automatically resized to Full HD for efficient processing
- Vectorized Operations: Uses NumPy's vectorized calculations instead of nested loops where possible
- Distance Matrix Calculation: Pre-computes distance matrices once per window size for speed
- Resize-based Average Calculation: Uses OpenCV's resize function to quickly compute average brightness values
Below is an example of the webcam processing effect.
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by traditional stippling art techniques
- Built with OpenCV and NumPy libraries