

def add_rgba_to_pixel(pixel, rgba, x_ammount, x_displacement):
    a = rgba[3]
    pa = pixel[3]
    if ((a == 1.0) and (pa == 1.0)):
        total_ammount = (x_ammount + x_displacement)
        rgba_ammount = (x_ammount / total_ammount)
        pixel_ammount = (x_displacement / total_ammount)
        return (((pixel[0] * pixel_ammount) + (rgba[0] * rgba_ammount)), ((pixel[1] * pixel_ammount) + (rgba[1] * rgba_ammount)), ((pixel[2] * pixel_ammount) + (rgba[2] * rgba_ammount)), ((pa * pixel_ammount) + (a * rgba_ammount)))
    else:
        total_ammount = (x_ammount + x_displacement)
        rgba_ammount = (x_ammount / total_ammount)
        pixel_ammount = (x_displacement / total_ammount)
        return (((pixel[0] * pixel_ammount) + (rgba[0] * rgba_ammount)), ((pixel[1] * pixel_ammount) + (rgba[1] * rgba_ammount)), ((pixel[2] * pixel_ammount) + (rgba[2] * rgba_ammount)), ((pa * pixel_ammount) + (a * rgba_ammount)))

dataset/ETHPy150Open francescortiz/image/image/utils.py add_rgba_to_pixel/original