繁体   English   中英

基于Gabor的纹理分割

[英]Gabor based Texture Segmentation

我正在尝试实现用于纹理图像分割的gabor滤镜。 我在MATLAB中做这个并咨询纸张的概念- 基于水平集和基于Gabor的主动轮廓算法用于分割纹理图像

我正在强调下面的相关部分: 2D gabor功能给出为

在此输入图像描述

哪里

在此输入图像描述

跨度限制的正弦光栅的频率F给出,其方向由Theta指定。 Sigma是比例参数。 该滤波器用于图像,并且由于gabor滤波器由虚部组成,因此如下所示获得Gabor变换

在此输入图像描述

其中,GR和GI是通过用图像u0卷积得到的实部和虚部。 我需要在MATLAB中对这部分进行编码,并为theta,F和sigma的不同值生成Gabor变换图像

我的代码

clc;clear all;close all;
sigma=.0075;
m_size=7;
theta=pi/4;
F=60;
[real_g,im_g]=gabor(m_size,sigma,F,theta);

//My Gabor function
function [real_g,im_g] = gabor(m_size,sigma,F,theta)
[x,y]=meshgrid(1:m_size,1:m_size);
real_g = zeros(m_size);
im_g = zeros(m_size);
g_sigma = zeros(m_size);
for i=1:size(x,1)
    for j=1:size(y,1)
        g_sigma(i,j) = (1./(2*pi*sigma^2)).*exp(((-1).*(i^2+j^2))./(2*sigma^2));
        real_g(i,j) = g_sigma(i,j).*cos((2*pi*F).*(i.*cos(theta)+j.*sin(theta)));
        im_g(i,j) = g_sigma(i,j).*sin((2*pi*F).*(i.*cos(theta)+j.*sin(theta)));
    end
end

我的输出

>> real_g

real_g =

     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0

>> im_g

im_g =

     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0
     0     0     0     0     0     0     0

我的gabor过滤器是完全错误的 请问你能帮我构建正确的gabor过滤器吗? 请注意,参数和公式的数据取自我已经提到的论文。

任何帮助将不胜感激。 PS如果有人需要纸张,我也可以邮寄。 谢谢。

希望以下代码对您正在进行的工作有所帮助。 它演示了如何使用具有不同色域的Gabor滤镜转换图像(如图所示)。 干杯。

具有不同θ的图像

% get image
u0=double(imread('cameraman.tif'));

% initialize parameters
sigma = 3;
m_size = 7;
F = 1;
m_size_halfed = round((m_size-1)/2);

% make up some thetas
thetas=0:pi/5:pi;

% loop through all thetas
for i = 1:numel(thetas)    
theta = thetas(i);

% setup the "gabor transform"
[x,y]=meshgrid(-m_size_halfed:m_size_halfed,-m_size_halfed:m_size_halfed);
g_sigma = (1./(2*pi*sigma^2)).*exp(((-1).*(x.^2+y.^2))./(2*sigma.^2));
real_g = g_sigma.*cos((2*pi*F).*(x.*cos(theta)+y.*sin(theta)));
im_g = g_sigma.*sin((2*pi*F).*(x.*cos(theta)+y.*sin(theta)));

% perform Gabor transform
u_0sft=sqrt(conv2(u0,real_g,'same').^2+conv2(u0,im_g,'same').^2);

subplot(1,numel(thetas)+1,i+1)
imagesc(u_0sft);
colormap('gray'); axis image; axis off;
title(sprintf('theta:%1.1f',theta));

end

% visualize image
subplot(1,numel(thetas)+1,1)
imagesc(u0);
colormap('gray'); axis image; axis off;
title('original');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM