예제 #1
0
 def __init__(self):
     self.stdw = 64
     self.stdh = 64
     self.gabors = []
     for w in range(5,21,5):
         for a in range(0,180,30):
             angle = a * math.pi / 180.0
             gb = gabor2d.create_gabor_2d(1,1,0,w,angle)
             self.gabors.append(gb)
예제 #2
0
 def __init__(self):
     self.stdw = 32
     self.stdh = 64
     self.flts = []
     for w in range(5, 21, 5):
         for a in range(0, 180, 30):
             angle = a * math.pi / 180.0
             gb = gabor2d.create_gabor_2d(1,1,0,w,angle)
             self.flts.append(gb)
예제 #3
0
파일: itti.py 프로젝트: z01nl1o02/tests
print 'pyd level = %d'%len(pyd[0])
if 0:
    for ch in pyd.keys():
        for level in pyd[ch].keys():
            for tmp in pyd[ch][level]:
                tmp = np.uint8( tmp )
                cv2.imshow('pyd', tmp)
                cv2.waitKey(-1)



gabors = []
for a in range(0,180,45):
    wl = 9
    gabor = gabor2d.create_gabor_2d(1,1,0,wl,math.pi * a / 180.0)
    gabors.append(gabor)
#    cv2.imshow("gabor",  get_image(gabor))
#    cv2.waitKey(-1)

for ch in pyd.keys():
    for level in pyd[ch].keys():
        tmp = np.uint8(pyd[ch][level][0])
        for ori,gabor in enumerate(gabors):
            res = cv2.filter2D(tmp, cv2.CV_32F, gabor)
            res = np.float32(res )
            res = 255 * (res - res.min()) / (res.max() - res.min())
            pyd[ch][level].append(res)

if 0:
    for ch in pyd.keys():
예제 #4
0
chn.append(np.float32(img))

pyd = []
pyd.extend(chn)
for s in range(1):
    for ch in chn:
        tmp = math.pow(2, s + 1)
        h0, w0 = ch.shape
        h1 = np.int64(h0 / tmp)
        w1 = np.int64(w0 / tmp)
        pyd.append(np.float32(cv2.resize(np.uint8(ch), (w1, h1))))

if 0:
    wl = 5
    for a in range(0, 180, 45):
        gabor = gabor2d.create_gabor_2d(1, 1, 0, wl, math.pi * a / 180.0)
        res = cv2.filter2D(np.uint8(pyd[-1]), cv2.CV_32F, gabor)
        #res = np.absolute(res)
        res = 255 * (res - res.min()) / (res.max() - res.min())
        pyd.append(np.float32(res))

w = np.int64(W / scale)
h = np.int64(H / scale)
for k in range(len(pyd)):
    tmp = pyd[k]
    #cv2.imshow('grad', get_image(tmp))
    #cv2.waitKey(-1)
    tmp = cv2.resize(tmp, (w, h))
    pyd[k] = tmp

delta = 5.0