def rg2_convert(arr):
    #assert(arr.min()>=0 and arr.max()<=1)

    out = np.empty_like(arr[:,:,[0,1]])

    red = arr[:,:,0]
    green = arr[:,:,1]
    #blue = arr[:,:,2]
    intensity = arr.mean(2)

    lowi = intensity < 0.1*intensity.max()
    arr[lowi] = 0

    denom = arr.sum(2)
    denom[denom==0] = 1
    out[:,:,0] = denom / red
    out[:,:,1] = green / denom
    
    return out

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