In [4]:
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import os

filepath = '/Users/cprakashagr/Pictures/CPPics/CP.png'

img = mpimg.imread(filepath)
print(img.shape)

plt.imshow(img)


(360, 360, 4)
Out[4]:
<matplotlib.image.AxesImage at 0x1085f1898>

In [5]:
plt.show()



In [7]:
import cv2
img2 = cv2.imread(filepath)

In [32]:
import tensorflow as tf

x = tf.Variable(img, name = 'x')
model = tf.initialize_all_variables()

with tf.Session() as session:
    x = tf.transpose(x, perm=[1, 0, 2])
    session.run(model)
    result = session.run(x)

plt.imshow(result)
plt.show()



In [53]:
img = mpimg.imread(filepath)
plt.imshow(img)
plt.show()
height, width, depth = img.shape

x = tf.Variable(img, name = 'x')
model = tf.initialize_all_variables()
with tf.Session() as session:
    x = tf.reverse_sequence(x, [width]*height, 1, batch_dim=0)
    session.run(model)
    result = session.run(x)
    
plt.imshow(result)
plt.show()



In [ ]: