saliency.py
def makeGaborFilter(dims, lambd, theta, psi, sigma, gamma):
	"""
		Creates a Gabor filter (an array) with parameters labmbd, theta,
		psi, sigma, and gamma of size dims.  Returns a function which 
		can be passed to `features' as `channel' argument.
		In some versions of OpenCV, sizes greater than (11,11) will lead
		to segfaults (see http://code.opencv.org/issues/2644).
	"""
	def xpf(i,j):
		return i*math.cos(theta) + j*math.sin(theta)
	def ypf(i,j):
		return -i*math.sin(theta) + j*math.cos(theta)
	def gabor(i,j):
		xp = xpf(i,j)
		yp = ypf(i,j)
		return math.exp(-(xp**2 + gamma**2*yp**2)/2*sigma**2) * math.cos(2*math.pi*xp/lambd + psi)
	
	halfwidth = dims[0]/2
	halfheight = dims[1]/2

	kernel = numpy.array([[gabor(halfwidth - i,halfheight - j) for j in range(dims[1])] for i in range(dims[1])])

	def theFilter(image):
		return cv2.filter2D(src = image, ddepth = -1, kernel = kernel, )

	return theFilter

		Creates a Gabor filter (an array) with parameters labmbd, theta,
		psi, sigma, and gamma of size dims.  Returns a function which 
		can be passed to `features' as `channel' argument.
		In some versions of OpenCV, sizes greater than (11,11) will lead
		to segfaults (see http://code.opencv.org/issues/2644).
	
Creates a Gabor filter (an array) with parameters labmbd, theta,
psi, sigma, and gamma of size dims.  Returns a function which
can be passed to `features' as `channel' argument.
In some versions of OpenCV, sizes greater than (11,11) will lead
to segfaults .
Creates a Gabor filter ( an array ) with parameters labmbd theta psi sigma and gamma of size dims . Returns a function which can be passed to ` features ' as ` channel ' argument . In some versions of OpenCV sizes greater than ( 11 11 ) will lead to segfaults .
def makeGaborFilter(dims, lambd, theta, psi, sigma, gamma):
	def xpf(i,j):
		return i*math.cos(theta) + j*math.sin(theta)
	def ypf(i,j):
		return -i*math.sin(theta) + j*math.cos(theta)
	def gabor(i,j):
		xp = xpf(i,j)
		yp = ypf(i,j)
		return math.exp(-(xp**2 + gamma**2*yp**2)/2*sigma**2) * math.cos(2*math.pi*xp/lambd + psi)
	halfwidth = dims[0]/2
	halfheight = dims[1]/2
	kernel = numpy.array([[gabor(halfwidth - i,halfheight - j) for j in range(dims[1])] for i in range(dims[1])])
	def theFilter(image):
		return cv2.filter2D(src = image, ddepth = -1, kernel = kernel, )
	return theFilter
def makeGaborFilter ( dims , lambd , theta , psi , sigma , gamma ) : def xpf ( i , j ) : return i * math . cos ( theta ) + j * math . sin ( theta ) def ypf ( i , j ) : return - i * math . sin ( theta ) + j * math . cos ( theta ) def gabor ( i , j ) : xp = xpf ( i , j ) yp = ypf ( i , j ) return math . exp ( - ( xp ** 2 + gamma ** 2 * yp ** 2 ) / 2 * sigma ** 2 ) * math . cos ( 2 * math . pi * xp / lambd + psi ) halfwidth = dims [ 0 ] / 2 halfheight = dims [ 1 ] / 2 kernel = numpy . array ( [ [ gabor ( halfwidth - i , halfheight - j ) for j in range ( dims [ 1 ] ) ] for i in range ( dims [ 1 ] ) ] ) def theFilter ( image ) : return cv2 . filter2D ( src = image , ddepth = - 1 , kernel = kernel , ) return theFilter
Creates a Gabor filter (an array) with parameters labmbd, theta,
psi, sigma, and gamma of size dims.
Creates a Gabor filter ( an array ) with parameters labmbd theta psi sigma and gamma of size dims .
"""
		Creates a Gabor filter (an array) with parameters labmbd, theta,
		psi, sigma, and gamma of size dims.  Returns a function which 
		can be passed to `features' as `channel' argument.
		In some versions of OpenCV, sizes greater than (11,11) will lead
		to segfaults (see http://code.opencv.org/issues/2644).
	"""
dims
lambd
theta
psi
sigma
gamma