saliency.py
def makeNormalizedColorChannels(image, thresholdRatio=10.):
	"""
		Creates a version of the (3-channel color) input image in which each of
		the (4) channels is normalized.  Implements color opponencies as per 
		Itti et al. (1998).
		Arguments:
			image			: input image (3 color channels)
			thresholdRatio	: the threshold below which to set all color values
								to zero.
		Returns:
			an output image with four normalized color channels for red, green,
			blue and yellow.
	"""
	intens = intensity(image)
	threshold = intens.max() / thresholdRatio
	logger.debug("Threshold: %d", threshold)
	r,g,b = cv2.split(image)
	cv2.threshold(src=r, dst=r, thresh=threshold, maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=g, dst=g, thresh=threshold, maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=b, dst=b, thresh=threshold, maxval=0.0, type=cv2.THRESH_TOZERO)
	R = r - (g + b) / 2
	G = g - (r + b) / 2
	B = b - (g + r) / 2
	Y = (r + g) / 2 - cv2.absdiff(r,g) / 2 - b

	# Negative values are set to zero.
	cv2.threshold(src=R, dst=R, thresh=0., maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=G, dst=G, thresh=0., maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=B, dst=B, thresh=0., maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=Y, dst=Y, thresh=0., maxval=0.0, type=cv2.THRESH_TOZERO)

	image = cv2.merge((R,G,B,Y))
	return image

		Creates a version of the (3-channel color) input image in which each of
		the (4) channels is normalized.  Implements color opponencies as per 
		Itti et al. (1998).
		Arguments:
			image			: input image (3 color channels)
			thresholdRatio	: the threshold below which to set all color values
								to zero.
		Returns:
			an output image with four normalized color channels for red, green,
			blue and yellow.
	
Creates a version of the (3-channel color) input image in which each of
the (4) channels is normalized.  Implements color opponencies as per
Itti et al.
Creates a version of the ( 3 - channel color ) input image in which each of the ( 4 ) channels is normalized . Implements color opponencies as per Itti et al .
def makeNormalizedColorChannels(image, thresholdRatio=10.):
	intens = intensity(image)
	threshold = intens.max() / thresholdRatio
	logger.debug("Threshold: %d", threshold)
	r,g,b = cv2.split(image)
	cv2.threshold(src=r, dst=r, thresh=threshold, maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=g, dst=g, thresh=threshold, maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=b, dst=b, thresh=threshold, maxval=0.0, type=cv2.THRESH_TOZERO)
	R = r - (g + b) / 2
	G = g - (r + b) / 2
	B = b - (g + r) / 2
	Y = (r + g) / 2 - cv2.absdiff(r,g) / 2 - b
	cv2.threshold(src=R, dst=R, thresh=0., maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=G, dst=G, thresh=0., maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=B, dst=B, thresh=0., maxval=0.0, type=cv2.THRESH_TOZERO)
	cv2.threshold(src=Y, dst=Y, thresh=0., maxval=0.0, type=cv2.THRESH_TOZERO)
	image = cv2.merge((R,G,B,Y))
	return image
def makeNormalizedColorChannels ( image , thresholdRatio = 10. ) : intens = intensity ( image ) threshold = intens . max ( ) / thresholdRatio logger . debug ( "Threshold: %d" , threshold ) r , g , b = cv2 . split ( image ) cv2 . threshold ( src = r , dst = r , thresh = threshold , maxval = 0.0 , type = cv2 . THRESH_TOZERO ) cv2 . threshold ( src = g , dst = g , thresh = threshold , maxval = 0.0 , type = cv2 . THRESH_TOZERO ) cv2 . threshold ( src = b , dst = b , thresh = threshold , maxval = 0.0 , type = cv2 . THRESH_TOZERO ) R = r - ( g + b ) / 2 G = g - ( r + b ) / 2 B = b - ( g + r ) / 2 Y = ( r + g ) / 2 - cv2 . absdiff ( r , g ) / 2 - b cv2 . threshold ( src = R , dst = R , thresh = 0. , maxval = 0.0 , type = cv2 . THRESH_TOZERO ) cv2 . threshold ( src = G , dst = G , thresh = 0. , maxval = 0.0 , type = cv2 . THRESH_TOZERO ) cv2 . threshold ( src = B , dst = B , thresh = 0. , maxval = 0.0 , type = cv2 . THRESH_TOZERO ) cv2 . threshold ( src = Y , dst = Y , thresh = 0. , maxval = 0.0 , type = cv2 . THRESH_TOZERO ) image = cv2 . merge ( ( R , G , B , Y ) ) return image
Creates a version of the (3-channel color) input image in which each of
the (4) channels is normalized.
Creates a version of the ( 3 - channel color ) input image in which each of the ( 4 ) channels is normalized .
"""
		Creates a version of the (3-channel color) input image in which each of
		the (4) channels is normalized.  Implements color opponencies as per 
		Itti et al. (1998).
		Arguments:
			image			: input image (3 color channels)
			thresholdRatio	: the threshold below which to set all color values
								to zero.
		Returns:
			an output image with four normalized color channels for red, green,
			blue and yellow.
	""" # Negative values are set to zero.
an output image with four normalized color channels for red, green,
blue and yellow.
an output image with four normalized color channels for red green blue and yellow .
image
thresholdRatio
image                   
input image (3 color channels)
input image ( 3 color channels )
thresholdRatio  
the threshold below which to set all color values
to zero.
the threshold below which to set all color values to zero .