代码:

"""
使用tf读取图片
"""


import tensorflow as tf
import matplotlib.pyplot as plt


image_raw = tf.gfile.FastGFile(r'C:\Users\Administrator\Desktop\meatwice\meatwice\01newCognition\reinforcement_learning\new_test_tensorflow\picture_set\b023260d27ab8087b5b7d73b837094d.png', \
                     'rb').read()

img = tf.image.decode_jpeg(image_raw)

with tf.Session() as sess:
    img1 = img.eval()
    # print(img1)
    print(img1.shape)

plt.figure(1)
plt.imshow(img1)
plt.show()

 

显示:

tf读取图片,matplotlib可视化

 

相关文章:

  • 2022-01-08
  • 2021-07-19
  • 2021-07-30
  • 2021-05-11
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2021-04-03
猜你喜欢
  • 2021-12-05
  • 2021-09-26
  • 2021-06-27
  • 2022-02-15
  • 2022-01-24
  • 2021-08-15
相关资源
相似解决方案