Home

Awesome

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

<img width="400" alt="rapela" src="https://github.com/heitorrapela/xdog/blob/master/imgs/rapela.jpg"> a) Original<img width="400" alt="rapela_grayscale" src="https://github.com/heitorrapela/xdog/blob/master/imgs/original_grayscale.jpg"> b) Grayscale<img width="400" alt="xdog_garygrossi" src="https://github.com/heitorrapela/xdog/blob/master/imgs/xdog_garygrossi.jpg"> c) Xdog GaryGrossi
<img width="400" alt="xdog_nat" src="https://github.com/heitorrapela/xdog/blob/master/imgs/xdog_naturalMedia.jpg"> d) Xdog Test Nat<img width="400" alt="xdog_project1" src="https://github.com/heitorrapela/xdog/blob/master/imgs/xdog_project1.jpg"> e) Xdog Test<img width="400" alt="xdog_hatch" src="https://github.com/heitorrapela/xdog/blob/master/imgs/xdog_hatch.jpg"> f) Xdog Hatch

Parameters


Demo of video_jit.py

Webcam XDoG Demo


Dependencies

If you want to run video_jit.py:

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