Skip to content

Converts a 2D Color Image ๐Ÿ–ผ into a Hand drawn Sketch โœ Using Novel Technique.

License

Notifications You must be signed in to change notification settings

anishLearnsToCode/image2sketch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Image 2 Sketch

๐Ÿ“ƒ Report | ๐Ÿ““ Explanation Notebook with Code | โญ Results

lenna-example

๐Ÿ“– Overview

  1. Introduction
  2. Current Method
  3. My Method (Novel Idea)
  4. A Few Results
  5. Running it On Your Machine
  6. Bibliography

Introduction

There are several methods to extract edges from images. There are also several other methods for object detection and region segmentation. In this project I propose a novel method for Feature extraction from Images and use this method to create sketch composite for the given Image.

Current Method

The current State of the art method is the Gaussian Blur-Blend Method which has the following algorithm:

def gaussian_blend_blur(I: image, k: Kernel Size):
    J = grayscale_of_image(I)
    K = gaussian_kernel_of_size(k, k)
    B = gaussian_blur_of_image_with_kernel(J, K)
    result = J / B
    return result

Novel Method

We introduce a new method for feature extraction, the Orthogonal Gaussian Lattice Method which takes 3 Gaussian and computes teh inverse of the grayscale of the image with these 3 Gaussian and then uses a connectivity bound parameter alpha to create 3 Simple Graphs from these inverse gaussian. These graphs are then used to extract Lattices from the image and these lattices are then used as features and for image sketching.

The algorithm is as follows and for full details please reefr to the Jupyter Notebook with Complete Explanation.

algorithm-1 algorithm-2 algorithm-3 algorithm-4 algorithm-5

A Few Results

butterfly-result swiss-1-results swiss-2-result dolphin-2-result flower-2-result flower-rose-result swiss-3-result

Running it On Your Machine

The program requires the following dependencies:

  1. Python 3
  2. pip
  3. Git

Clone and install all dependencies:

git clone https://github.com/anishLearnsToCode/image2sketch.git
cd image2sketch
mkdir results
mkdir data
pip install -r requirements.txt

To test this program on some sample images see src/test.py. Create a directory /data under the project root and add some sample images there for testing purposes. Preferably add PNG Images as they store full data without compression. Inside src/test.py set the path to yor image and you can also further change Hyper-parameters from the file src/control_parameters.py and run it as

cd src
python test.py 

Results will be displayed and also saved under the directory results/{image_name} where image_name comes from src/test.py.

Bibliography

  1. How to create a beautiful pencil sketch effect with OpenCV and Python ~Ask A Swiss
  2. Open CV
  3. Python 3
  4. Git
  5. Graph Theory and Its Applications to Image Segmentation ~IEEE
  6. Image Sketch Online
  7. Photofunia Sketch Effect
  8. convertimage.net
  9. Convert Image to GrayScale ~KD Nuggets
  10. pip

About

Converts a 2D Color Image ๐Ÿ–ผ into a Hand drawn Sketch โœ Using Novel Technique.

Topics

Resources

License

Stars

Watchers

Forks