matlab实现gabor filter (5)
来源:互联网 发布:摄像头监控软件下载 编辑:程序博客网 时间:2024/05/16 05:56
gabor filter源代码:
%%%%%%%VERSION 2%%ANOTHER DESCRIBTION OF GABOR FILTER%The Gabor filter is basically a Gaussian (with variances sx and sy along x and y-axes respectively)%modulated by a complex sinusoid (with centre frequencies U and V along x and y-axes respectively) %described by the following equation%%% -1 x' ^ y' ^ %%% G(x,y,theta,f) = exp ([----{(----) 2+(----) 2}])*cos(2*pi*f*x');% 2 sx' sy'%%% x' = x*cos(theta)+y*sin(theta);%%% y' = y*cos(theta)-x*sin(theta);%% Describtion :%% I : Input image%% Sx & Sy : Variances along x and y-axes respectively%% f : The frequency of the sinusoidal function%% theta : The orientation of Gabor filter%% G : The output filter as described above%% gabout : The output filtered image%% Author : Ahmad poursaberi e-mail : a.poursaberi@ece.ut.ac.ir%% Faulty of Engineering, Electrical&Computer Department,Tehran%% University,Iran,June 2004function [G,gabout] = gaborfilter1(I,Sx,Sy,f,theta)if isa(I,'double')~=1 I = double(I);endfor x = -fix(Sx):fix(Sx) for y = -fix(Sy):fix(Sy) xPrime = x * cos(theta) + y * sin(theta); yPrime = y * cos(theta) - x * sin(theta); G(fix(Sx)+x+1,fix(Sy)+y+1) = exp(-.5*((xPrime/Sx)^2+(yPrime/Sy)^2))*cos(2*pi*f*xPrime); endendImgabout = conv2(I,double(imag(G)),'same');Regabout = conv2(I,double(real(G)),'same');gabout = sqrt(Imgabout.*Imgabout + Regabout.*Regabout);
调用代码:
close all;clear all;clc;% 读入图像image=imread('C:\Users\watkins\Pictures\cartoon.jpg');grayImage=rgb2gray(image);grayImage=im2double(grayImage);% 显示读入图像imshow(grayImage);sx=32;sy=32;theta=[0 pi/4 2*pi/4 3*pi/4 4*pi/4 5*pi/4 6*pi/4 7*pi/4];gamma=1;psi=0;sigma=6; % 也可以为12lambda=[5 6 7 8 9];V=[4 5 6 7 8];U=[0 pi/4 2*pi/4 3*pi/4 4*pi/4 5*pi/4 6*pi/4 7*pi];%U=[1 2 3 4 5 6 7 8];% Creating 40 Gabor FiltersG = cell(5,8);for i = 1:5 for j = 1:8 G{i,j}=zeros(65,65); endendfor i = 1:5 for j = 1:8 f=1/lambda(i); %[T,gabout] = gaborfilter(grayImage,sx,sy,U(j),V(i)); %G{i,j} = T; G{i,j} = gaborfilter1(grayImage,sx,sy,f,theta(j)); endend% Showing Gabor Filtersfigure;for s = 1:5 for j = 1:8 subplot(5,8,(s-1)*8+j); %imshow(real(G{s,j})/2-0.5,[]); imshow(real(G{s,j}),[]); endend
显示的滤波器组图片:
可以明显看到波长和方向的变化
- matlab实现gabor filter (5)
- matlab实现gabor filter (1)
- matlab实现gabor filter (2)
- matlab实现gabor filter (3)
- matlab实现gabor filter (4)
- matlab实现gabor filter (6)
- matlab实现gabor filter (7)
- matlab实现gabor filter (8) 效果很好
- matlab实现gabor filter (9) 效果很好
- matlab实现gabor filter (10) 效果很好
- matlab实现gabor filter 多种方式汇总
- matlab中实现Gabor滤波器
- 2D-Gabor Matlab实现
- matlab中实现Gabor滤波器
- matlab中实现Gabor滤波器
- Gabor filter
- Gabor Filter
- Gabor filter
- 基于注解的 Spring MVC 简单入门
- zoj2878
- hdu 4370 从数学就变成了图。。。。
- android系统移植emmc记录(1) --制作SD卡启动u-boot .
- solrj实现solr的suggestion(基于spellcheck)
- matlab实现gabor filter (5)
- 目标关键词一定要与网站内容相关
- android系统移植emmc记录(2)--u-boot烧写emmc方式 .
- hexdump命令使用
- android系统移植emmc记录(3)--sd/mmc初始化 .
- hdu1232 很不错 要看 并查集
- android 自定义弹出框AlertDialog ,很炫的哦
- 《Effective C++》读书笔记之item27:尽量少做转型动作
- hdu_4374 One hundred layer解题报告