python 借助opencv实现Gabor滤波特征提取
2017-12-19 11:35
3443 查看
首先说一下环境,windows 8.0 64位系统,OpenCV版本为2.4.7, python 版本为2.7.6,IDE为 64位 Anaconda
目的是实现图像的Gabor特征提取,分三个小程序完成
包含头文件:
程序一,gaborl滤波器的构建,使用6个尺度分四个方向
程序二,滤波过程
程序三,特征图生成并显示
结果展示如下:
24个滤波器核
24个滤波结果
转自这里
目的是实现图像的Gabor特征提取,分三个小程序完成
包含头文件:
import cv2 import numpy as np import pylab as pl
程序一,gaborl滤波器的构建,使用6个尺度分四个方向
**### 构建Gabor滤波器 def build_filters(): filters = [] ksize = [7,9,11,13,15,17] # gabor尺度,6个 lamda = np.pi/2.0 #波长 for theta in np.arange(0, np.pi, np.pi / 4): #gabor方向,0°,45°,90°,135°,共四个 for K in xrange(6): kern = cv2.getGaborKernel((ksize[K], ksize[K]), 1.0, theta, lamda, 0.5, 0, ktype=cv2.CV_32F) kern /= 1.5*kern.sum() filters.append(kern) return filters
程序二,滤波过程
### Gabor滤波过程 def process(img, filters): accum = np.zeros_like(img) for kern in filters: fimg = cv2.filter2D(img, cv2.CV_8UC3, kern) np.maximum(accum, fimg, accum) return accum
程序三,特征图生成并显示
### Gabor特征提取 def getGabor(img,filters): res = [] #滤波结果 for i in xrange(len(filters)): res1 = process(img, filters[i]) res.append(np.asarray(res1)) pl.figure(2) for temp in xrange(len(res)): pl.subplot(4,6,temp+1) pl.imshow(res[temp], cmap='gray' ) pl.show() return res #返回滤波结果,结果为24幅图,按照gabor角度排列
结果展示如下:
24个滤波器核
24个滤波结果
转自这里
相关文章推荐
- python 借助opencv实现Gabor滤波特征提取
- Dlib + python + opencv 实时人脸68特征点提取
- OpenCV实现SfM(一):双目三维重建(包含SIFT特征点提取)
- Python实现椒盐噪声、中值滤波、均值滤波,OpenCV
- python+opencv实现高斯平滑滤波
- Gabor实现图像特征提取
- Gabor滤波进行目标图像纹理特征的提取
- 关于opencv-python特征提取的一些问题。
- 人脸识别特征提取(LBP)及其opencv实现
- python实现图片处理和特征提取详解
- Gabor滤波小结的OpenCV实现
- 图像处理之Gabor滤波提取纹理特征
- SIFT特征提取及其opencv实现
- 用Python和OpenCV提取颜色直方图特征
- 图像处理中,SIFT,FAST,MSER,STAR等特征提取算法的比较与分析(利用openCV实现)
- 【图像特征提取12】OpenCv的SIFT图像局部特征提取描述算法C++代码的实现
- Good Features to track特征点检测原理与opencv(python)实现
- CVPR读书笔记[5]:Gabor特征提取之Gabor核的实现
- 基于ORB特征提取算法图像匹配 python实现
- Gabor滤波简介和实现(Matlab,OpenCV)