A Streamlit-based application that allows users to upload an image and apply one of three cartoonization techniques to transform it into a stylized cartoon version.
- About the Project
- Features
- Getting Started
- Installation
- Running Script
- Expectations When Running This App
- Demo
- Acknowledgments
- License
This Cartoonizer App is a simple yet powerful image processing tool that applies different cartoonization techniques to an uploaded image. It uses OpenCV and Streamlit for performance, visualization, and user interaction.
The app applies one of the following techniques to generate a cartoon-style version of the input image:
- Bilateral Filtering + Edge Detection – Smooths and sharpens edges for a cartoon-like effect.
- Color Quantization + Edge Enhancement – Reduces colors and sharpens edges for a more stylized look.
- Laplacian Edge Detection – Uses edge detection to enhance sharpness and detail.
The user can select a technique, upload an image, and view both the original and cartoonized versions on the app.
- Easy-to-use Streamlit interface.
- Supports common image formats:
.jpg
,.jpeg
, and.png
. - Three different cartoonization techniques:
- Bilateral Filtering + Edge Detection
- Color Quantization + Edge Enhancement
- Laplacian Edge Detection
- Real-time preview of the original and cartoonized image.
Before you begin, ensure you have the following installed:
Dependency | Version |
---|---|
Python | 3.8+ |
Streamlit | ≥1.20 |
OpenCV | ≥4.5 |
Pillow | ≥9.1 |
You can install them using pip:
pip install streamlit opencv-python pillow
To install and run the app locally:
# Clone this repository (if needed)
git clone https://github.com/YOUR_GITHUB_USERNAME/img-cartoonizer-using-opencv.git
cd img-cartoonizer-using-opencv
# Install dependencies
pip install streamlit opencv-python pillow
# Run the app
streamlit run app.py
Once installed, simply run the following command in your terminal:
streamlit run app.py
This will launch the Streamlit application in your browser, where you can interact with the app.
- The user must upload an image in
.jpg
,.jpeg
, or.png
format. - One of the three cartoonization techniques must be selected from the dropdown menu.
- The output will display both the original and cartoonized versions of the image side-by-side.
⚠️ If no file is uploaded or a method is not selected, the app will not show any processed image.
Here’s a quick overview of how the app looks in action:
- Open your browser and go to
http://localhost:8501
(or the URL provided by Streamlit). - Upload an image.
- Select a cartoonization method.
- View the original and processed images on the web app UI.
cartoonizing-image.mp4
- Streamlit – For the easy-to-use UI.
- OpenCV – For powerful image processing capabilities.
- Pillow (PIL) – For handling and displaying images in the app.
This project is licensed under the MIT License — see the LICENSE file for details.