saliency.py
def features(image, channel, levels=9, start_size=(1983, 1088), ):
	"""
		Extracts features by down-scaling the image levels times,
		transforms the image by applying the function channel to 
		each scaled version and computing the difference between 
		the scaled, transformed	versions.
			image : 		the image
			channel : 		a function which transforms the image into
							another image of the same size
			levels : 		number of scaling levels
			start_size : 	tuple.  The size of the biggest image in 
							the scaling	pyramid.  The image is first
							scaled to that size and then scaled by half
							levels times.  Therefore, both entries in
							start_size must be divisible by 2^levels.
	"""
	image = channel(image)
	if image.shape != start_size:
		image = cv2.resize(image, dsize=start_size)

	scales = [image]
	for l in xrange(levels - 1):
		logger.debug("scaling at level %d", l)
		scales.append(cv2.pyrDown(scales[-1]))

	features = []
	for i in xrange(1, levels - 5):
		big = scales[i]
		for j in (3,4):
			logger.debug("computing features for levels %d and %d", i, i + j)
			small = scales[i + j]
			srcsize = small.shape[1],small.shape[0]
			dstsize = big.shape[1],big.shape[0]
			logger.debug("Shape source: %s, Shape target :%s", srcsize, dstsize)
			scaled = cv2.resize(src=small, dsize=dstsize)
			features.append(((i+1,j+1),cv2.absdiff(big, scaled)))

	return features

		Extracts features by down-scaling the image levels times,
		transforms the image by applying the function channel to 
		each scaled version and computing the difference between 
		the scaled, transformed	versions.
			image : 		the image
			channel : 		a function which transforms the image into
							another image of the same size
			levels : 		number of scaling levels
			start_size : 	tuple.  The size of the biggest image in 
							the scaling	pyramid.  The image is first
							scaled to that size and then scaled by half
							levels times.  Therefore, both entries in
							start_size must be divisible by 2^levels.
	
Extracts features by down-scaling the image levels times,
transforms the image by applying the function channel to
each scaled version and computing the difference between
the scaled, transformed versions.
image :                 the image
channel :               a function which transforms the image into
another image of the same size
levels :                number of scaling levels
start_size :    tuple.  The size of the biggest image in
the scaling     pyramid.  The image is first
scaled to that size and then scaled by half
levels times.  Therefore, both entries in
start_size must be divisible by 2^levels.
Extracts features by down - scaling the image levels times transforms the image by applying the function channel to each scaled version and computing the difference between the scaled transformed versions . image : the image channel : a function which transforms the image into another image of the same size levels : number of scaling levels start_size : tuple . The size of the biggest image in the scaling pyramid . The image is first scaled to that size and then scaled by half levels times . Therefore both entries in start_size must be divisible by 2^levels .
def features(image, channel, levels=9, start_size=(1983, 1088), ):
	image = channel(image)
	if image.shape != start_size:
		image = cv2.resize(image, dsize=start_size)
	scales = [image]
	for l in xrange(levels - 1):
		logger.debug("scaling at level %d", l)
		scales.append(cv2.pyrDown(scales[-1]))
	features = []
	for i in xrange(1, levels - 5):
		big = scales[i]
		for j in (3,4):
			logger.debug("computing features for levels %d and %d", i, i + j)
			small = scales[i + j]
			srcsize = small.shape[1],small.shape[0]
			dstsize = big.shape[1],big.shape[0]
			logger.debug("Shape source: %s, Shape target :%s", srcsize, dstsize)
			scaled = cv2.resize(src=small, dsize=dstsize)
			features.append(((i+1,j+1),cv2.absdiff(big, scaled)))
	return features
def features ( image , channel , levels = 9 , start_size = ( 1983 , 1088 ) , ) : image = channel ( image ) if image . shape != start_size : image = cv2 . resize ( image , dsize = start_size ) scales = [ image ] for l in xrange ( levels - 1 ) : logger . debug ( "scaling at level %d" , l ) scales . append ( cv2 . pyrDown ( scales [ - 1 ] ) ) features = [ ] for i in xrange ( 1 , levels - 5 ) : big = scales [ i ] for j in ( 3 , 4 ) : logger . debug ( "computing features for levels %d and %d" , i , i + j ) small = scales [ i + j ] srcsize = small . shape [ 1 ] , small . shape [ 0 ] dstsize = big . shape [ 1 ] , big . shape [ 0 ] logger . debug ( "Shape source: %s, Shape target :%s" , srcsize , dstsize ) scaled = cv2 . resize ( src = small , dsize = dstsize ) features . append ( ( ( i + 1 , j + 1 ) , cv2 . absdiff ( big , scaled ) ) ) return features
Extracts features by down-scaling the image levels times,
transforms the image by applying the function channel to
each scaled version and computing the difference between
the scaled, transformed versions.
Extracts features by down - scaling the image levels times transforms the image by applying the function channel to each scaled version and computing the difference between the scaled transformed versions .
"""
		Extracts features by down-scaling the image levels times,
		transforms the image by applying the function channel to 
		each scaled version and computing the difference between 
		the scaled, transformed	versions.
			image : 		the image
			channel : 		a function which transforms the image into
							another image of the same size
			levels : 		number of scaling levels
			start_size : 	tuple.  The size of the biggest image in 
							the scaling	pyramid.  The image is first
							scaled to that size and then scaled by half
							levels times.  Therefore, both entries in
							start_size must be divisible by 2^levels.
	"""
image
channel
levels
start_size