def compute_intensity(image_r, image_g=None, image_b=None):
 if ((image_g is None) or (image_b is None)):
  if (not ((image_g is None) and (image_b is None))):
   raise ValueError(u'please specify either a single image or red, green, and blue images.')
  return image_r
 intensity = (((image_r + image_g) + image_b) / 3.0)
 return np.asarray(intensity, dtype=image_r.dtype)

def compute_intensity ( image_r , image_g = None , image_b = None ) : if ( ( image_g is None ) or ( image_b is None ) ) : if ( not ( ( image_g is None ) and ( image_b is None ) ) ) : raise ValueError ( u'please specify either a single image or red, green, and blue images.' ) return image_r intensity = ( ( ( image_r + image_g ) + image_b ) / 3.0 ) return np . asarray ( intensity , dtype = image_r . dtype )
return a naive total intensity from the red .