1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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)
|