aboutsummaryrefslogtreecommitdiff
path: root/gabor.py
diff options
context:
space:
mode:
Diffstat (limited to 'gabor.py')
-rwxr-xr-xgabor.py30
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)