# xdog
**Repository Path**: HaiXiu/xdog
## Basic Information
- **Project Name**: xdog
- **Description**: 边缘提取算法,克隆自: https://github.com/heitorrapela/xdog
- **Primary Language**: Python
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2022-05-03
- **Last Updated**: 2022-06-24
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# 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
| | | |
|:-------------------------:|:-------------------------:|:-------------------------:|
a) Original |
b) Grayscale |
c) Xdog GaryGrossi
d) Xdog Test Nat |
e) Xdog Test |
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

----------
## 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](https://numba.pydata.org/)
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:

## References used in these project
[Xdog Article](http://www.kyprianidis.com/p/cag2012/winnemoeller-cag2012.pdf)
[garygrossi/XDoG-Python](https://github.com/garygrossi/XDoG-Python)