def separate_stains(rgb, conv_matrix):
 rgb = dtype.img_as_float(rgb, force_copy=True)
 rgb += 2
 stains = np.dot(np.reshape((- np.log(rgb)), ((-1), 3)), conv_matrix)
 return np.reshape(stains, rgb.shape)

def separate_stains ( rgb , conv_matrix ) : rgb = dtype . img_as_float ( rgb , force_copy = True ) rgb += 2 stains = np . dot ( np . reshape ( ( - np . log ( rgb ) ) , ( ( - 1 ) , 3 ) ) , conv_matrix ) return np . reshape ( stains , rgb . shape )
rgb to stain color space conversion .