本文介绍了使用Gabor或自定义原子的MATLAB Matching Pursuit wmpdictionary的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MATLAB 2013,现在包括Matching Pursuit算法.它具有一个称为 wmpdictionary 的功能,用于创建字典.据我所知,能够使用下一个函数在字典中创建原子:

I'm using MATLAB 2013 which now includes Matching Pursuit algorithm. It has a function called wmpdictionary for creating a dictionary. As far as I know is capable of using the next functions to create atoms in the dictionary:

  • 离散余弦变换II基础
  • 正弦波
  • 余弦
  • 多项式
  • 转移的克罗内克三角洲
  • 有效的正交或双正交小波族

我想/需要使用 Gabor 原子.

有人知道如何在wmpdictionary中使用Gabor或另选一种自定义新型原子的方法吗?

Does someone knows how to use Gabor in wmpdictionary or alternatively a way to customize new kinds of atoms?.

------------------最终解决了------------------好吧,我在论文中找到了一个Gabor原子的公式[1].我使用以下功能生成了字典:

------------------FINALLY SOLVED------------------Well I found a formula for Gabor atoms in the paper [1].I generated a dictionary using these functions:

function atom = getGaborAtom(N,scale,timeShift,frequency,phase)
%This function obtains a Gabor atom of given parameters
%N- Length of the signal
%scale- must be in number of samples
%timeShift - must be in number of samples
%frequency - its normalized frequency from 0 to 0.5   f/fs;
%Phase - a value from 0 to 2 pi
%This version uses the number of samples but seconds can also be used.

atom =zeros(N,1);
for n=1:N
    atom(n,1) = (1/sqrt(scale))*exp(-pi*(n-timeShift)^2/scale^2) * cos(2*pi*frequency*    (n-timeShift)+phase);
end
atom = (1/norm(atom)) .* atom;   %Normalization
end

function [dictionary parameters]=constructDictionaryGabor()
%Construct a Gabor dictionary 
%parameters are scale timeshift and frequency

N=256;  %Size of the atom
scales = [2^1 2^2 2^3 2^4];  %More scales can be added
freqs  = [0 .001 .002 .05 .1 .2 .3 .4 .5];  % f/fs normalized frequency. More freqs can be added
timeShifts = [0 64 128];  %More time shifts can be added
phase =0; %More phase values can be added, here I'm fixinf phase to 0


dictionary = zeros(N,length(scales)*length(freqs)*length(timeShifts)*length(phase));
parameters = zeros(3,length(scales)*length(freqs)*length(timeShifts)*length(phase);
contador = 1;

for t=1:length(timeShifts)
    for f=1:length(freqs)
        for s=1:length(scales)
            dictionary(:,contador) = getGaborAtom(N,scales(s),timeShifts(t),freqs(f),phase);
            parameters(:,contador) = [scales(s) timeShifts(t) freqs(f)];
            contador = contador+1;
        end
    end
end
end

此字典可与wmpdictionary函数一起使用,矩阵参数具有每个原子的参数.

This dictionary can be used with the function wmpdictionary, the matrix parameteres has the parameters per each atom.

[1]具有时频音频功能的环境声音识别

[1] Environmental Sound Recognition With Time–Frequency Audio Features

推荐答案

您应该下载并安装MPTK,该工具包具有多个功能,并且比wmpalg更快.您还可以进行多通道分解,并轻松定义自己的字典.

You should download and install MPTK, this toolkit has several features and is faster than wmpalg. You can also make multichannel decompositions and define your own dictionaries easily.

这篇关于使用Gabor或自定义原子的MATLAB Matching Pursuit wmpdictionary的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 11:45