Created
December 25, 2019 13:00
-
-
Save Puzer/8f954b16feded5922c4b0d37f768ece3 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
import tensorflow as tf | |
from tensorflow.contrib.image import matrices_to_flat_transforms, transform | |
sess = tf.Session() | |
# affine_M = [[ 0.14, 0. , -18.4 ], | |
# [ -0. , 0.14, -16.28], | |
# [0, 0, 1]] | |
affine_M = np.vstack([tfm_mean, # <- M which might be used in cv2.warpAffine | |
np.array([[0, 0, 1]])]) | |
projective_M = sess.run(matrices_to_flat_transforms(tf.linalg.inv(affine_M))) | |
wraped_image = sess.run(transform(np.array(img), | |
projective_M, | |
output_shape=(crop_size, crop_size))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment