matlab实现gabor filter (6)
来源:互联网 发布:移动网络电视打开步骤 编辑:程序博客网 时间:2024/09/21 08:18
代码:
%%%%%%%VERSION 3%%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 -1 x ^ y ^%%% Gi(x,y) = ---------- * exp ([----{(----) 2+(----) 2}])*Mi(x,y,f); % 2*pi*sx*sy 2 sx sy%%% i =1,2%%% M1(x,y,f) = cos[2*pi*f*sqrt(x^2+y^2)];%%% M2(x,y,f) = cos[2*pi*f*(x*cos(theta) + y*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%% G1 & G2 : The output filters as described above%% gabout1 & gabout2 : The output filtered images%% Author : Ahmad poursaberi e-mail : a.poursaberi@ece.ut.ac.ir%% Faulty of Engineering, Electrical&Computer Department,Tehran%% University,Iran,June 2004function [G1,G2,gabout1,gabout2] = gaborfilter2(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) M1 = cos(2*pi*f*sqrt(x^2+y^2)); M2 = cos(2*pi*f*(x*cos(theta)+y*sin(theta))); G1(fix(Sx)+x+1,fix(Sy)+y+1) = (1/(2*pi*Sx*Sy)) * exp(-.5*((x/Sx)^2+(y/Sy)^2))*M1; G2(fix(Sx)+x+1,fix(Sy)+y+1) = (1/(2*pi*Sx*Sy)) * exp(-.5*((x/Sx)^2+(y/Sy)^2))*M2; endendImgabout1 = conv2(I,double(imag(G1)),'same');Regabout1 = conv2(I,double(real(G1)),'same');Imgabout2 = conv2(I,double(imag(G2)),'same');Regabout2 = conv2(I,double(real(G2)),'same');gabout1 = sqrt(Imgabout1.*Imgabout1 + Regabout1.*Regabout1);gabout2 = sqrt(Imgabout2.*Imgabout2 + Regabout2.*Regabout2);
调用代码:
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)); [T1,T2] = gaborfilter2(grayImage,sx,sy,f,theta(j)); G{i,j} = T2; 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 (6)
- matlab实现gabor filter (1)
- matlab实现gabor filter (2)
- matlab实现gabor filter (3)
- matlab实现gabor filter (4)
- matlab实现gabor filter (5)
- 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
- opensuse如何进行上网设置(待租约的)----待解决
- mysql添加用户、删除用户、授权、修改密码等
- hdu 1392 凸包问题
- Ubuntu学习
- android系统移植emmc记录(6)--sd卡烧写文件分析 .
- matlab实现gabor filter (6)
- 最短路 SPFA (对于bellman-ford 的优化)
- android系统移植emmc记录(总) .
- javascript表格操作大全:表格排序/倒序、动态添加列、批量删除、删除一行、隔行变色、鼠标悬浮切换背景色、全选/反选。(IE、火狐都兼容)
- 我应该感谢你吗?CSDN
- 【Android学习笔记】ListVIew学习(表格输出)
- iOS 内存管理
- 河北大学算法艺术协会
- 2012暑期多校8总结