How to build Gabor dictionary for sparse representation in Python

153 Views Asked by At

I want to build a Gabor dictionary to perform sparse approximation of 1D sequences. I've already implemented the Orthogonal Matching Pursuit algorithm in Python language, and have successfully used other types of dictionaries, such as fft and dct. I wonder if the following is a correct way to build the Gabor basis dictionary in Python. In this way the dictionary results in complex values, is that correct? My source for the Gabor fuction is "B.S. Manjunath, S.D. Newsam - Handbook of Image and Video Processing (Second Edition, 2005), which states: (here the excerpt)

import numpy as np
from scipy.fft import fft

N = 1024                                    # N x N dictionary
t = np.linspace(0, 2*np.pi, N)
D = fft(np.eye(N), axis=0)                  # Fourier dictionary                         
sigma = 1
gauss = 1/(np.sqrt(2*np.pi)*sigma)*np.exp((-t**2)/(2*sigma**2)).reshape((N,1))
G = np.multiply(D,gauss)                    # Gabor dictionary
0

There are 0 best solutions below