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

For Cartoonify Image Using ML

PowerPoint presentation for Cartoonify image 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 PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views10 pages

For Cartoonify Image Using ML

PowerPoint presentation for Cartoonify image 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 PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Cartoonify Your

Image with
Python
Transform your photos into cartoon-like versions using Python and
OpenCV. This project demonstrates how to use OpenCV to create a simple
cartoonifier that transforms images into cartoon-style versions with
smooth colors and highlighted edges.

by Sri Sai chandu Adabala


What is OpenCV?
OpenCV (Open Source Computer Vision) is a cross-platform library for
computer vision tasks, including image and video processing. It is widely
used for applications such as image transformation, object detection, and
face recognition.
Objective
We will build a Python application using OpenCV to cartoonify images,
transforming them into cartoon-like versions.

1 Cartoonify Images
Transform images into cartoon-like versions using Python and
OpenCV.

2 Image Processing
Use OpenCV to perform image processing tasks, such as image
transformation, object detection, and face recognition.

3 Python Application
Develop a Python application to cartoonify images.
Steps to Develop Image Cartoonifier

1 Import Required Modules


Import necessary modules: CV2 for image processing, EasyGUI for file selection, NumPy for array management, ImageIO for file reading, Matplotlib for plotting, and OS for file handling.

2 File Box to Choose a File


Use EasyGUI's fileopenbox() to allow users to choose an image file.

3 Storing an Image
Convert the image into a NumPy array using cv2.imread(). Images are represented as arrays of pixel values (RGB).

4 Convert Image to Grayscale


Use cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) to transform the image into a grayscale version.

5 Smoothen the Grayscale Image


Apply a median blur to smooth the grayscale image.

6 Retrieve Edges
Use adaptive thresholding to extract the edges from the image for the cartoon effect.

7 Prepare a Mask Image


Apply bilateral filtering to smoothen the color image while preserving edges.

8 Apply Cartoon Effect


Mask the smoothed color image with the extracted edges using cv2.bitwise_and().

9 Plot the Transitions


Use Matplotlib to visualize the various transformations (original, grayscale, smoothed, edge-detected, and cartoonified images).
Import Required Modules
Import necessary modules: CV2 for image processing, EasyGUI for file selection, NumPy for array management, ImageIO
for file reading, Matplotlib for plotting, and OS for file handling.

CV2 EasyGUI
For image processing. To select files from the system.

NumPy ImageIO
To manage images as arrays. For reading files.

Matplotlib OS
For plotting images. For file handling.
File Box to Choose a File
Use EasyGUI's fileopenbox() to allow users to choose an image file.

File Selection
Use EasyGUI's fileopenbox() to allow users to choose an
image file.

Image File
The selected image file will be used for cartoonification.
Storing an Image
Convert the image into a NumPy array using cv2.imread(). Images are represented as arrays of pixel values (RGB).

Image Conversion NumPy Array

Convert the image into a NumPy array using cv2.imread(). Images are represented as arrays of pixel values (RGB).
Convert Image to
Grayscale
Use cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) to transform the image
into a grayscale version.

Grayscale Conversion
Use cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) to transform the image
into a grayscale version.
Smoothen the Grayscale Image
Apply a median blur to smooth the grayscale image.

Grayscale Image Smoothened Grayscale Image

High-frequency noise Reduced noise

Sharp edges Softened edges


Final Result
Once all transformations are applied, the user can save and view their cartoonified image.

Cartoonified Image
The final cartoonified image with smooth colors and highlighted edges.

You might also like