[go: up one dir, main page]

0% found this document useful (0 votes)
64 views10 pages

Cartoonify Your Image With Python: by Chandu Adabala

Ppt for machine learning using ml
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views10 pages

Cartoonify Your Image With Python: by Chandu Adabala

Ppt for machine learning using ml
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Cartoonify Your

Image with Python


This presentation will guide you through the process of cartoonifying
images using Python. We will explore the libraries, code breakdown, and
step-by-step process involved in creating a cartoon effect from real
images.

by Chandu Adabala
Introduction to Image
Cartoonification
What is Cartoonification?
Cartoonification is the process of converting a real image into a
cartoon-like effect.

Applications
Cartoonification has various applications, including image editing
software, mobile apps for photo transformations, and artistic rendering
of images.
Required Libraries

1 OpenCV (cv2)
OpenCV is used for image processing tasks like reading, filtering,
and manipulating images.

2 EasyGUI (easygui)
EasyGUI simplifies file dialogs for choosing an image file.

3 NumPy (numpy)
NumPy is used for efficient array operations (handling image pixel
data).

4 Matplotlib (matplotlib.pyplot)
Matplotlib is used to visualize images in different stages.
Code Breakdown: User Interface
Tkinter Window Setup Functionality

The code starts by initializing a Tkinter window with the The Upload Button allows users to browse and upload
title "Cartoonify Your Image!" an image for cartoonification.

Label and Button widgets are used to create a user-


friendly interface.
Cartoonification Process:
Step-by-Step

1 Step 1: Image Upload


Easygui.fileopenbox() allows users to select an image.

2 Step 2: Read Image Using OpenCV


The uploaded image is read using cv2.imread(), and color
conversion is applied using cv2.cvtColor().
Image Processing Steps
Step 3: Grayscale Conversion
1 Converts the image to grayscale using cv2.cvtColor().

Step 4: Smoothing Using Median Blur


2 Applies a median blur to reduce noise and smoothen the
grayscale image.

Step 5: Edge Detection


3 Uses adaptive thresholding to extract the edges for the
cartoon effect.
Final Cartoon Effect
Step 6: Bilateral Filtering
1 Bilateral filtering is applied to the original image to reduce noise while preserving edges.

Step 7: Masking
2 Combines the edge-detected image and the filtered color image using cv2.bitwise_and(), giving the final
cartoon effect.
Plotting the Stages

Using Matplotlib
The various stages of the image transformation are displayed side-by-side using subplots.
Saving the Cartoonified Image
Save Functionality User Notification

The save function allows the user to save the A message box informs the user when the image has
cartoonified image. been saved.

cv2.imwrite() is used to write the image to the disk.


Final GUI Components

Graphical User Interface (GUI) Tkinter


Buttons for uploading and saving images. The GUI created using Tkinter makes it easy for users to
interact with the application without using command-line
input.

You might also like