diff options
author | Franklin Wei <franklin@rockbox.org> | 2019-12-09 01:20:26 -0500 |
---|---|---|
committer | Franklin Wei <franklin@rockbox.org> | 2019-12-09 01:20:26 -0500 |
commit | 98224b1be453c99fa07457848e9c6b3adce5f314 (patch) | |
tree | 8792e60e64071c6fd31d61941f767ae2d70e0d44 /gabor.py | |
parent | 929bacc2867b42690d28a18cee57a285d9987a51 (diff) | |
download | sloreg-98224b1be453c99fa07457848e9c6b3adce5f314.zip sloreg-98224b1be453c99fa07457848e9c6b3adce5f314.tar.gz sloreg-98224b1be453c99fa07457848e9c6b3adce5f314.tar.bz2 sloreg-98224b1be453c99fa07457848e9c6b3adce5f314.tar.xz |
Add old python code
Diffstat (limited to '')
-rwxr-xr-x | gabor.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gabor.py b/gabor.py new file mode 100755 index 0000000..07d1e0e --- /dev/null +++ b/gabor.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +import cv2 +import numpy as np +from util import * + +KSIZE=21 + +for i in range(1, 22 + 1): + path="SLO Data for registration/SLO001/SLO_subject001_frame" + str(i) + ".png" + img = cv2.imread(path) + img = ~img # invert + + img = img[:] * 2 + + # cv2.getGaborKernel(ksize, sigma, theta, lambda, gamma, psi, ktype) + # ksize - size of gabor filter (n, n) + # sigma - standard deviation of the gaussian function + # theta - orientation of the normal to the parallel stripes + # lambda - wavelength of the sunusoidal factor + # gamma - spatial aspect ratio + # psi - phase offset + # ktype - type and range of values that each pixel in the gabor kernel can hold + kern = cv2.getGaborKernel((KSIZE, KSIZE), 8.0, np.pi/4, 10.0, 0.5, 0, ktype=cv2.CV_32F) + showResized("frame", img) + showResized("kern", kern) + + filt = cv2.filter2D(img, cv2.CV_8U, kern) + showResized("filtered", filt) + cv2.waitKey(0) |