Convert raster images into stylized, vector-like artwork using machine learning techniques.
Original | Vectorized |
---|---|
![]() |
![]() |
The example room images used in this repository were created by me using 3D modeling in Blender for this project.
Developed for Application Design 2 course (4th semester Interaction Design) at HfG Schwäbisch Gmünd. Created to vectorize image sequences with consistent colors for animations.
🔗 University Project: SideBy - HfG Exhibition
- 🎨 Color Reduction via K-means clustering
- ⚫ Black & White Mode with customizable grey levels
- 🎬 Sequence Processing for consistent animation colors
- 📝 Edge Detection for manga/anime style outlines
- ⚙️ Easy Configuration - just edit settings at top of files
Manga Style![]() |
Minimalist![]() |
Black & White![]() |
Thin Lines![]() |
No Edges![]() |
Simple B&W![]() |
pip install opencv-python numpy matplotlib scikit-learn scipy pillow
python examples.py # See style gallery
python examples.py
Check examples/style_gallery/
for different artistic styles.
Edit settings in image_vectorizer.py
:
DEFAULT_COLORS = 8 # Number of colors (2-50)
DEFAULT_BLACK_WHITE = False # True for B&W mode
DEFAULT_EDGE_THRESHOLD1 = 100 # Edge thickness
Then run: python image_vectorizer.py
Put images in examples_image_sequence/room-animation/
Edit sequence_vectorizer.py
:
SEQUENCE_COLORS = 6 # Colors for entire sequence
SEQUENCE_BLACK_WHITE = False # True for B&W sequences
Then run: python sequence_vectorizer.py
python main.py --input "photo.jpg" --output "result.png" --colors 6 --black-white
See the Style Gallery above for visual examples of each style:
Manga Style: 6-8 colors, edges 30/100, B&W mode optional
Minimalist: 3-4 colors, smoothing 3.0
Clean Lines: 8-12 colors, edges 80/200
image_vectorizer.py
- Main engine, edit settings heresequence_vectorizer.py
- For consistent animation sequencesexamples.py
- Style gallery generatormain.py
- Command line interface
- Colors: 3-6 (minimal), 8-12 (balanced), 15+ (detailed)
- Black & White: Use 4-10 colors for grey levels
- Edges: 30/100 (thick manga), 80/200 (thin), 100/250 (minimal)
MIT License - Feel free to use and modify for your own projects!