GithubHelp home page GithubHelp logo

maskjp / xdog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heitorrapela/xdog

0.0 2.0 0.0 24.09 MB

Extended Difference of Gaussians (xDoG) implementation

License: MIT License

Python 100.00%

xdog's Introduction

python-xdog

Simple implementation of XDoG

There are two principle files: main.py to run xdog implementation with image and video_jit to run in "real time" with webcam

rapela a) Original rapela_grayscale b) Grayscale xdog_garygrossi c) Xdog GaryGrossi
xdog_nat d) Xdog Test Nat xdog_project1 e) Xdog Test xdog_hatch f) Xdog Hatch

Parameters

  • a) Original image RGB
  • b) Load as grayscale (OpenCV)
  • c) XdogGary: sigma=0.5, k=200, gamma=0.98, epsilon=0.1, phi=10
  • d) Xdog this project: sigma=1, k=1.6, gamma=0.5, epsilon=-0.5, phi=10
  • e) Xdog this project: sigma=0.4, k=1.6, gamma=0.5, epsilon=-0.5, phi=10
  • f) Xdog this project: hatchBlend function

Demo of video_jit.py

Webcam XDoG Demo


Dependencies

  • Python 2.7

  • OpenCV (Tested on 2.4.13)

     sudo apt-get install python-opencv
    
  • Numpy 1.11.2

     pip install numpy
    

If you want to run video_jit.py:

  • Numba

     conda install numba
    

There is a requirement.txt to install numpy and numba:

pip install -r requirements.txt

Test time in Difference of Gaussians (DoG) implementation

start = time.time()
img1 = cv2.GaussianBlur(img,(0,0),0.5)
elapsed = time.time() - start
elapsed = 0.000515937805176

start = time.time()	
sigma = 0.5
gauss1 = gaussian_filter(img, 0.5)
elapsed = time.time() - start
print elapsed

elapsed = 0.00245594978333

So opencv cv2.GaussianBlur is faster. The difference from gaussian blur results from OpenCV and SciPy is similar.
The difference from each mat can be seen in image below:

Difference from mat of cv2.GaussianBlur and gaussian_filter

References used in these project

Xdog Article

garygrossi/XDoG-Python

xdog's People

Contributors

heitorrapela avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.