tensorflow里面用于改变图像大小的函数
2017-05-24 19:16
323 查看
tensorflow里面用于改变图像大小的函数是tf.image.resize_images(image, (w, h), method):image表示需要改变此存的图像,第二个参数改变之后图像的大小,method用于表示改变图像过程用的差值方法。0:双线性差值。1:最近邻居法。2:双三次插值法。3:面积插值法。
例如:
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.float32)
resize_0 = tf.image.resize_images(img_data_jpg, (500, 500), method=0)
resize_1 = tf.image.resize_images(img_data_jpg, (500, 500), method=1)
resize_2 = tf.image.resize_images(img_data_jpg, (500, 500), method=2)
resize_3 = tf.image.resize_images(img_data_jpg, (500, 500), method=3)
print resize_0.get_shape
plt.figure(0)
plt.imshow(resize_0.eval())
plt.figure(1)
plt.imshow(resize_1.eval())
plt.figure(2)
plt.imshow(resize_2.eval())
plt.figure(3)
plt.imshow(resize_3.eval())
plt.show()
结果:
例如:
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.float32)
resize_0 = tf.image.resize_images(img_data_jpg, (500, 500), method=0)
resize_1 = tf.image.resize_images(img_data_jpg, (500, 500), method=1)
resize_2 = tf.image.resize_images(img_data_jpg, (500, 500), method=2)
resize_3 = tf.image.resize_images(img_data_jpg, (500, 500), method=3)
print resize_0.get_shape
plt.figure(0)
plt.imshow(resize_0.eval())
plt.figure(1)
plt.imshow(resize_1.eval())
plt.figure(2)
plt.imshow(resize_2.eval())
plt.figure(3)
plt.imshow(resize_3.eval())
plt.show()
结果:
相关文章推荐
- OpenCV学习笔记:resize函数改变图像的大小
- OpenCV resize函数改变图像的大小
- imresize函数改变图像大小,插值
- Tensorflow中图像处理函数(图像大小调整)
- C# GDI画图 改变图像大小
- matlab imresize 改变图像大小
- opencv--用鼠标动态改变显示图像窗口大小
- Halcon学习之七:改变图像的现实方式和大小
- 改变bitmap大小的函数
- Qt实现图像自适应窗口大小之scaled()函数使用
- C#图像处理(各种旋转、改变大小、柔化、锐化、雾化、底片、浮雕、黑白、滤镜效果)
- 两个openCV补充函数。用于不同位数图像之间转换的。。
- C#图像处理(各种旋转、改变大小、柔化、锐化、雾化、底片、浮雕、黑白、滤镜效果)
- C#图像处理(各种旋转、改变大小、柔化、锐化、雾化、底片、浮雕、黑白、滤镜效果)
- VC改变BMP图像大小
- C#图像处理(各种旋转、改变大小、柔化、锐化、雾化、底片、浮雕、黑白、滤镜效果)
- 当窗体改变大小时控件大小随之改变(使用函数)
- vfp改变图像尺寸的大小
- 用于判断密码强度、密码大小写字母的js函数
- 【转】C#图像处理(各种旋转、改变大小、柔化、锐化、雾化、底片、浮雕、黑白、滤镜效果)