def gup(im): F = gskernel(3, 1) # for i in F: # print(i) t = conv.Convolve(im, F) #高斯滤波 t = gdown(t) #下采样 return t[0:int(im.shape[0] / 2), 0:int(im.shape[1] / 2)]
def yanzheng(g, l): huanyuan = [] for i in range(len(l)): t = l[i] + conv.Convolve(imresize.imresize(g[i + 1], g[i].shape), gskernel(3, 1), 3) huanyuan.append(t) listImShow(huanyuan) return huanyuan
def lpyr(gsim): lplcim = [] for i in range(len(gsim) - 1): # t=gsim[i]-imresize.imresize(gsim[i+1],gsim[i].shape) t = gsim[i] - conv.Convolve( imresize.imresize(gsim[i + 1], gsim[i].shape), gskernel(3, 1), 3) # tmin=t.min() # t=t+abs(tmin) # tmax=t.max() # t=t/tmax*255.0 lplcim.append(t) return lplcim
def set_muti_gpyr(self): self.make_list_sigmond() self.muti.append([]) self.muti[0].append(self.im) for i in range(self.ceng): if i != 0: self.muti.append([]) self.muti[i].append(cv2.pyrDown(self.muti[i - 1][-3])) for j in range(self.s): self.muti[i].append( conv.Convolve( self.muti[i][0], pyr.gskernel(15, self.list_sigmond[self.ceng * i + j])))
def Gsup(im): F = gskernel(3, 1) t = conv.Convolve(im, F) #高斯滤波 t = gdown(t) #下采样 return t[0:int(im.shape[0] / 2), 0:int(im.shape[1] / 2)]
c = Theta * ((bins[index] < Theta) & (Theta < bins[index + 1])) avg = c.sum() / hist[index] return avg t = np.zeros((16, 16)) for i in range(t.shape[0]): for j in range(t.shape[1]): t[i][j] = (8 - i)**2 + (8 - j)**2 imageA = cv2.imread("1.jpg").astype(np.uint8) #imageA = cv2.imread("left_01.png") imageA = cv2.cvtColor(imageA, cv2.COLOR_BGR2GRAY) t = imageA conv.show(t) t = conv.Convolve(t, pyr.gskernel(5, 10)) print(pyr.gskernel(5, 10)) print(cv2.getGaussianKernel(5, 10)) conv.show(t) sigma = 1.6 m, theta = describe_M_Theta(t, sigma) print(m.shape, theta.shape) print(m) print(theta) avg = main_direction(theta) print(avg)