tensorflow实现对图像的编码
来源:互联网 发布:西部数码 域名管理 编辑:程序博客网 时间:2024/06/06 22:38
tensorflow里面含有编码函数,可以编码成为jpg或者png格式的图片。
例如:
import matplotlib.pyplot as plt;import tensorflow as tf;image_raw_data_jpg = tf.gfile.FastGFile('11.jpg', 'r').read()with tf.Session() as sess:img_data_jpg = tf.image.decode_jpeg(image_raw_data_jpg) #解码img_data_jpg = tf.image.convert_image_dtype(img_data_jpg, dtype=tf.uint8)encode_image_jpg = tf.image.encode_jpeg(img_data_jpg) #jpg编码encode_image_png = tf.image.encode_png(img_data_jpg)#png编码with tf.gfile.GFile('output.jpg', 'wb') as f:f.write(encode_image_jpg.eval())with tf.gfile.GFile('output.png', 'wb') as f:f.write(encode_image_png.eval())结果:
阅读全文
0 0
- tensorflow实现对图像的编码
- tensorflow实现图像的翻转
- 【TensorFlow】数据处理(对图像的处理)
- 基于tensorflow实现图像风格的变换
- tensorflow实现图像的裁剪和填充
- tensorflow实现图像的等比例裁剪
- tensorflow实现图像色彩的调整
- TensorFlow实现自编码
- Tensorflow 实现自编码
- tensorflow 对Recursive NN的完美实现
- tensorflow实现对图片的读取
- Tensorflow实现简单图像探索
- tensorflow实现基于深度学习的图像补全
- TensorFlow实现基于深度学习的图像补全
- TensorFlow实战5:利用卷积神经网络对图像分类(初阶:MNIST手写数字)代码实现
- TensorFlow进阶:CNN对CIFAR10图像分类
- VC++实现对退化图像的恢复
- matlab实现对图像的切割
- cdoj_758_P酱的冒险旅途
- Apache2.4 启动闪退
- composer安装流程
- socket系列(三)——Spring-socket实时通信、推送
- 嵌入式开发基础二
- tensorflow实现对图像的编码
- 定点乘法技术
- Linux运维笔记-文档总结-postfix邮件传输服务
- 在线聊天系统,关键代码,(jquery.ajax)
- HMM之维特比算法
- zabbix安装配置
- Apache+Tomcat实现负载均衡及集群(session同步)--三、动静分离(1)使用mod_jk
- HardFault_Handler问题查找方法
- 用单例封装 SharedPreferences