The function calculates the average of the two images Input1 and Input2 pixel by pixel and generates the Output image.