def oppnorm_convert(arr, threshold=0.1):
    #assert(arr.min()>=0 and arr.max()<=1)
    #out = sp.empty_like(arr)
    arr = arr.astype('float32')
    out = np.empty(arr.shape[:2]+(2,), dtype='float32')

    print out.shape

    # red-green
    out[:,:,0] = arr[:,:,1] - arr[:,:,0]
    # blue-yellow
    out[:,:,1] = arr[:,:,2] - arr[:,:,[0,1]].min(2)
    # intensity
    denom = arr.max(2)

    mask = denom < threshold#*denom[:,:,2].mean()
    
    out[:,:,0] /= denom    
    out[:,:,1] /= denom

    np.putmask(out[:,:,0], mask, 0)
    np.putmask(out[:,:,1], mask, 0)

    return out

# ------------------------------------------------------------------------------
dataset/ETHPy150Open bolme/pyvision/src/pyvision/features/v1like.py/oppnorm_convert/swapped operands of `-`