0% found this document useful (0 votes)
18 views15 pages

Image Cartoonify Project Report

ddfgbh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views15 pages

Image Cartoonify Project Report

ddfgbh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

A

Major Project Report


On
Image Cartoonify
In partial fulfillment of the requirement for the award of the degree of

SUBMITTED BY
Ketan Kumar Gupta(0901IT171025)

SUBMITTED TO
Prof. Abhilash Sonkar

Department of Information Technology


Madhav Institute of Technology and Science, Gwalior
(A Govt. Aided UGC Autonomous & NAAC Accredited Institute Affiliated to RGPV, Bhopal)
Session: 2020-21

1 | Page
Madhav Institute of Technology and Science, Gwalior (M.P.)
(A Govt. Aided UGC Autonomous & NAAC Accredited Institute Affiliated to RGPV, Bhopal)

CANDIDATE'S DECLARATION
I hereby declare that the Project entitled “Image Cartoonify” which is being
submitted in the partial fulfilment of the requirement for the award of Bachelor of
Technology in Information Technology.

All information in this document has been obtained and presented in accordance
with academic rules and ethical conduct. I have fully cited and referenced all
material and results that are not original to this work.

To the best of my knowledge the material presented in this Project has not been
submitted elsewhere for the award of any other degree/diploma.

Date: 03-06-2021

Place: Gwalior Ketan Kumar Gupta

(0901IT171025)

2 | Page
Content
Topic Page No.
1. Introduction 4
Introduction
a.
b. Problem Statement
c. Overview
2. System Requirement 5
3. System Analysis and Design 6
4. Implementation 7
5. Conclusion and Future Scope 14
6. References 14

3 | Page
1. INTRODUCTION
Introduction :-

Do you miss your youth? Indeed, everybody does.! So for now how
about we head towards giving all photos some cartoonic impacts. This
undertaking is about for building a photograph cartoonifyer picture
converter utilizing Python and OpenCV.

This marvel was started in the Middle Ages, and first portrayed the
preliminary of imagination drawing for a piece of a workmanship, like a
canvas, drawing, or a stained glass window. In the nineteenth century,
the beginning in Punch magazine in 1843, animation and its belongings
came to allude – incidentally at the first – to silly representations in quite
a while just as in papers. Then, at that point, it likewise was utilized for
political kid's shows and furthermore in funny cartoons. At the point
when correspondence tranfes medium produced for move or get the
workmanship, in the mid twentieth century, it will started to allude the
energized films which looked like on paper kid's shows. Furthermore, its
impact. With the new accomplishment of Instagram, Facebook the
prominence of basic and fun photograph impacts applications has been
on the ascent on the sky. The versatile/IOS stage presents a novel field
for these applications by interfacing clients with both the necessary
resources to catch pictures, and for computational ability to perform
modern handling on these pictures. Toonify tries to the influence the
current one of the renowned OpenCV library for Python to copy a
specific impact known as cell-concealing in PC illustrations world.

Problem statement:-Convert the Real Image to Cartoonify Image


utilizing Python with Open CV Library
Overview:-

4 | Page
OpenCV is the open-source python library for PC vision and the AI. It's
fundamental objective to arrive at continuous PC vision and picture
preparing. OpenCV library achieve various procedure on pictures which
changes in various methods. It conveys all dialects like Python, C++,
Android, Java, and so forth It is not difficult to utilize and sought after
due to its provisions and making picture preparing and delivering
application utilizing various dialects. I might want to change while
bringing in the CV2 library of OpenCV. We make outlines, kid's shows,
and different changes on a customary picture.

2. System requirements:-
a. Modern Operating System
i. Windows 7 or 10
ii. Mac OS X 10.11 or higher, 64-bit
iii. Linux: RHEL 6/7, 64-bit (almost all libraries also work
in Ubuntu)
b. X86 64-bit CPU (Intel / AMD architecture)
c. 4 GB RAM
d. 5 GB free disk space
e. Installed Python (version 3.3 or above)

3. System analysis and Design:-

5 | Page
We can undoubtedly change the genuine pic over to Cartnooify
Image. It will help us in numerous ways like making story with the
assistance of animation picture and making of Comic Books or in
addition, we can make a short video with the assistance of
Cartoonify Images. The point of that task is to make a Python
project utilizing with OpenCV with interface permitting clients to
apply the cartoonify calculation. This Algorithm is intended to give
delightful and incredibly engaging outcomes on a wide a scope of
pictures quickly, despite the fact that it is surrendered that all
sources of info will yield as well as similarly fulfilling brings about
the world.
OpenCV is the open-source python library for PC vision and the
AI. It's essential target to show up at continuous PC vision and
picture getting ready. OpenCV library accomplish different
strategy on pictures which changes in different techniques. It
passes on all tongues like Python, C++, Android, Java, etc It isn't
hard to use and pursued because of its arrangements and making
picture taking care of and conveying application using different
vernaculars. I should change while getting the CV2 library of
OpenCV. We make draws, child's shows, and various changes on a
typical picture..
CV2: This is import to utilize OpenCV library for picture
preparing.
easygui is import to open a record box. It will take the picture or
record from our framework.
Numpy is imported because Images are put away and in prepared
as numbers. These are taken as exhibits.
Imageio: this is imported to peruse/compose document by record
box utilizing a way from the framework.
Matplotlib: This library is imported for representation and plotting
charts.
Operating system For OS collaboration. For taking the document
area and giving area that we made. For OS imported.

4. Implementation:-
6 | Page
Step 1: Importing the required modules
We will import the accompanying modules:

•CV2: This is import to utilize OpenCV library for picture preparing.


•easygui: is import to open a record box. It will take the picture or record
from our framework.
•Numpy: Images are put away and in prepared as numbers. These are taken
as clusters.
•Imageio: this is imported to peruse/compose record by document box
utilizing a way from the framework.
•Matplotlib: This library is imported for perception and plotting charts.
•OS: For OS association. For taking the record area and giving area that we
made.

Step 2: Making a File Box that pick a document from


framework
we fabricate the primary window of our application, where the buttons,
marks, and pictures, text region are put. We likewise give a title to that
document box utilizing title().

The given code opens the document put away, the spring up box to pick the
record from the framework, which opens each time at whatever point you
run the code. fileopenbox() is the capacity in easyGUI module which returns
the way of picked record as a string design.

7 | Page
NOTE: Now, all the activity is finished by the button click, in this way all the
underneath steps are the piece of remaining strategies for cartoonify (ImagePath).

Step 3: How is an image stored?


How a program read a picture? For a general PC, everything is simply
numbers. In the beneath code, we convert our picture into the numpy exhibit
utilizing their strategies.

Explanation:
"imread" is a technique in cv2 library which is permits to store pictures in the
configuration of numbers. Picture is perused in numpy exhibit design, however in
cell esteems portray R, G, and B upsides of the pixel from the picture.
NOTE: We always resize the image after each and every transformation to display
images on same scale at last.

Starting with picture changes:From beginning to this progression of an


animation, different changes has been finished. Then, at that point, a picture is
convert to the Grayscale picture. Indeed, it is relied upon like the old day's
photos… .. Then, at that point, this Grayscale picture is smoothened. Ultimately,
we structure a shading picture just as cover it with edges.

Let’s begin with that type transformations to convert an smoothened image to


its cartoonify image.

Step 4: Changing a picture to grayscale

8 | Page
cvtColor(image, banner) work in cv2 library that is utilized to make a picture into
its shading space as 'banner'. Here, I'll do my initial move towards the picture into
grayscale [Link], we make a BGR2GRAY banner. This gives the picture in
grayscale. This picture is caught as grayScaleImage.

After every single change, we redo the resultant picture with the capacity name
resize() technique in cv2 and show it utilizing imshow() capacity of cv2. It will
gives us more changes of the pictures.

Step 5: Smoothening a grayscale image

For smoothen a picture, We put suddenly impact. This is finished utilizing


medianBlur() work. Here, the center picture pixel is allotted a mean worth of the
relative multitude of pixels that fall under the piece mode. Thus, making a haze
impact.

Stage 6: Capturing the edges from the picture

Animation impact has two claims to fame:

1. Highlighted Edges

9 | Page
2. Smooth tones

Right off the bat, we look on the primary forte. Here, we get the edges and featured
them. This is framed by versatile thresholding method. This limit esteem is the
mean of the local pixel esteems less the consistent C. C is deducted from the mean
or/and the weighted amount of the local pixels. The thresh_binary is look like of
edge applied, and the last or rest boundaries deciding the square size.

Stage 7: Preparing a Mask Image

In the given code, we work on the second and more significant forte. I make an
eased up shading picture that we cover or cross-over with edges toward the finish
to develop a cartoonify picture. We use bilateralFilter what separate the
commotion. It very well may be the smoothening of a picture to the degree.

Our third boundary is the measurement of pixel area. That number of pixels around
a specific pixel that will choose these worth. The fourth and Fifth boundary
characterizes the signmaColor and sigmaSpace depending on the situation. This
load of boundaries are produce as thet sigma results. At last our picture appear as
though awful and like water paint, and pull out the unpleasantness in colors.

Indeed, it's exceptionally BEAUTIFUL impact or AI impact or auto Beautify in


cameras of present day portable Android/IOS telephones.

Step 8: Giving a Cartoon Effect

In this way, how about we consolidate the two claims to fame. This will be
finished utilizing MASKING. We give the bitwise AND administrator on two
pictures to veil them to get the eventual outcome. Keep in mind, pictures are
simply numbers?

10 | Page
At long last, We gave this how we veil edged picture to our "Enhance" picture.

This at long last CARTOONIFY our picture!

Furthermore, the impending pictures are unique to Final Cartoonify Image

11 | Page
Stage 10: Functionally of save button

The following stage, to save the Final picture to our framework. For that
part, we can extricate the way of the document picture, and simply add the
tail (name of the old record) to get new name and store the cartoonify picture
with another name in a similar envelope by affixing the new name from the
past name way of record we do the altered string.

For this, we make out the head part of the record way by giving the
[Link]() strategy. Essentially, [Link](ImagePath) uses to
get the expansion of the document from the way of the framework.

At last, newName stores "Cartoonified_Image" added to the past name as


the name of another document. [Link](path1, newName + expansion)
joins the way to the newname and [Link] will make the total way for
the new cartoonify picture document…

imwrite() strategy for cv2 library to save the document at the way
referenced. [Link](ReSized6, cv2.COLOR_RGB2BGR) isn't 100%
assurance yet gives high precision that no shading get take out or featured
while we save our picture. In this manner, Ultimately, the client will give
affirmation that the picture is put away and saved with the name and way of
the record in the archives envelope.

Step 11: Making the main window

12 | Page
Stage 12: Building the Image animation button in fundamental
window

Stage 13: Making a Save button in the spring up box principle


window tab.

13 | Page
Stage 14: Finally Main capacity to make the tkinter window

5. Conclusion and Future Scope:-


Everything happened considered, the Cartoonify picture
calculation is an achievement of numerous things. It can delivering
precisely the outcome that predefined above, and a wide scope of
info pictures will yield as palatable outcomes to their pictures.
Notwithstanding, the calculation isn't great, yet and it doesn't react
typically across all data sources or only one out of every odd data
sources. In future, a versatile calculation or present day would
presumably be more qualified to giving a steady impact to this
calculation. For example, calculation would perceive picture types
(representation, indoor scene, open air scene for example, or man
pic pics) and afterward change the edge identification boundaries
to improve suit in future specific picture This may help the
calculation in drawing shapes around locales of various shadings.
Right now, the calculation appears to be most appropriate for
pictures that have a couple of huge locales, each with somewhat
low shading variety. Normally the pictures that come up short are
those with a high measure of nearby shading variety and detail.
And now it also can be used for cartoonify any image onwards.
This is widely use for comics, novels, picture story and much
more.

6. References:-

1. [Link]
2. [Link]
3. [Link]
4. [Link]
5. [Link]
python/sS

14 | Page
15 | Page

Common questions

Powered by AI

The essential technologies and libraries for an image cartoonification project include Python as the programming language and OpenCV as the primary library for computer vision and image processing. OpenCV, particularly its CV2 module, is crucial for operations like file handling, capturing edges, and other image transformations. Additionally, Numpy is needed for numerical operations as images are processed as arrays of numbers, while easygui is used for file dialog operations. For image file reading and writing, Imageio is utilized, and Matplotlib is used for visualization and plotting images. These technologies enable the development of a robust image cartoonification application .

OpenCV is considered suitable for real-time computer vision projects like cartoonification due to its comprehensive functionality and performance optimizations that allow real-time processing. Its support for multiple programming languages, including Python, C++, and Java, enhances its applicability across different platforms. OpenCV's efficient algorithms for image processing, including edge detection, filtering, and transformations, enable the development of complex applications like cartoonifying images with minimal latency. Additionally, its vast collection of libraries caters to various computer vision needs, making it an ideal choice for projects requiring real-time image manipulation .

The cartoonification algorithm enhances image details primarily through edge detection and smoothing techniques. Initially, the image undergoes a conversion to grayscale using the cvtColor function from the cv2 library, after which it is smoothened with the medianBlur() function to reduce noise. Edges are accentuated via adaptive thresholding, highlighting them as a significant part of the cartoon style. To achieve smooth color transitions, a bilateral filter is applied, which helps in maintaining sharp edges while smoothing out the rest of the image, thereby producing a cartoonish effect. By masking the highlighted edges over the smoothened coloring, the algorithm produces a stylized result that emulates the traditional animation appearance .

To enhance the algorithm's adaptability, developing a mechanism to differentiate image types such as portrait, indoor, outdoor, etc., and dynamically adjusting the edge detection and filtering parameters would be beneficial. Implementing machine learning techniques could allow the algorithm to learn optimal settings for different image styles, improving performance on diverse inputs. Additionally, integrating more sophisticated noise reduction and detail retention techniques, such as non-linear filtering methods, could help maintain quality across high-detail images. Enhancing the algorithm to intelligently segment images and apply custom filter values per region can further optimize results .

Certain images may not yield satisfactory results when processed with the cartoonification algorithm due to high local color variation and intricate details that do not translate well into the simplified style the algorithm produces. The algorithm is primarily designed to work best with large regions of uniform color and minimal fine detail. Images with significant texture or intricate patterns can challenge the boundary detection and smooth coloring processes, leading to less visually appealing results. The algorithm's performance is also dependent on parameter settings for edge detection and smoothing, which might not suit all types of images equally well .

During the cartoonification process, an image is converted into grayscale using the cvtColor function from the cv2 library with the BGR2GRAY flag. This transformation reduces the image into grayscale by mixing its primary colors (Red, Green, and Blue) into a single intensity value, effectively making it a single-channel image. Converting to grayscale is a critical step in preparing the image for further processing like smoothening and edge detection, since it simplifies the data, making computations less intensive and more focused on the structures of the image .

Edge detection in the cartoonification algorithm is implemented using adaptive thresholding techniques. This method calculates a threshold value based on the mean pixel values of a local neighborhood around each pixel. It is crucial as it highlights the strong edges of the image, which are fundamental to the cartoon aesthetic, providing the outlines and defining features of the cartoonified image. These edges become the framework over which the simplified colors, generated by the bilateral filter, are laid, creating the final cartoon effect. Without accurate edge detection, the cartoon effect would lose its distinct separation of regions, which is vital to its style .

The system requirements for executing an image cartoonification application include a modern operating system such as Windows 7 or 10, Mac OS X 10.11 or higher, or Linux (RHEL 6/7, with compatibility for Ubuntu). A 64-bit CPU from either Intel or AMD architecture is necessary, along with at least 4 GB of RAM and 5 GB of free disk space. Additionally, Python version 3.3 or above must be installed for running the application, which utilizes Python-related libraries for image processing tasks .

A cartoonification tool using OpenCV and Python has various applications across multiple domains. It could be used for creating personalized comic books and graphic novels by converting images into stylized frames. In the digital entertainment industry, it offers a method for generating unique visual effects for media content. Basic photo editing apps could use cartoonification to attract users with fun and engaging filters. In animation, such tools could provide an efficient starting point for the development of frame-by-frame animation by transforming reference images into simplified versions that animators can use as guides .

In the cartoonification process, the bilateral filter plays a crucial role by separating image noise while preserving edges, which is essential for achieving the cartoon effect. It achieves this by averaging pixel values based on both spatial proximity and pixel value similarity, thus smoothing out colors within regions while keeping boundaries sharp. The effect of the bilateral filter is a more distinct edge and uniform color distribution across regions, which contributes to the stylized, less detailed look characteristic of cartoon images. This balance between detail retention and noise reduction is fundamental in achieving the desired cartoon-like appearance .

You might also like