Last active
November 20, 2021 16:07
-
-
Save shayaf84/68fbdbb1249825173d35b560f7a52767 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def interpolation(baseline, image, alpha): | |
#Interpolates images by computing the difference between its pixel values | |
#and the baseline (all zeroes) | |
#From there, construct a new tensor containing the baseline and interpolated | |
#images, which are the picture values multiplied by the linear relationship. | |
alphaTensor = alpha[:, tf.newaxis, tf.newaxis, tf.newaxis] | |
baselineTensor = tf.expand_dims(baseline, axis=0) | |
inputTensor = tf.expand_dims(image, axis=0) | |
diff = inputTensor - baselineTensor | |
images = baselineTensor + alphaTensor * diff | |
return images |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment