tensorflow opencv demo

  • 2017-07-05
  • 20
  • 0
  • 0
TensorFlow与OpenCV,读取图片,进行简单操作并显示 难度1
import tensorflow as tf  import tensorflow as tf  import cv2    #file_path = ‘/Users/cloveai/Desktop/’  #ilename = ‘1.jpg’
image = cv2.imread(‘/Users/cloveai/Desktop/1.jpg’, 1)  cv2.namedWindow(‘image’, 0)  cv2.imshow(‘image’, image)
# Create a TensorFlow Variable  x = tf.Variable(image, name=’x’)    #model = tf.initialize_all_variables()  model = tf.global_variables_initializer()with tf.Session() as session: x = tf.transpose(x, perm=[1, 0, 2]) session.run(model) result = session.run(x)  cv2.namedWindow(‘result’, 0)  cv2.imshow(‘result’, result)  cv2.waitKey(0)

评论

如果没有评论就会看到我(不要戳我)

有何高论