from:https://blog.csdn.net/uestc_c2_403/article/details/72703097

tensorflow内部含有实现图像翻转的函数为

tf.image.flip_up_down:从上向下翻转

tf.image.flip_left_right:从左到又翻转

tf.image.transpose_image:对角线翻转

tf.image.random_flip_up_down:以一定概率从上向下翻转

tf.image.random_flip_left_right:以一定概率从左到又翻转

例如:

  1. import matplotlib.pyplot as plt;
  2. import tensorflow as tf;
  3. image_raw_data_jpg = tf.gfile.FastGFile('11.jpg', 'r').read()
  4. with tf.Session() as sess:
  5. img_data_jpg = tf.image.decode_jpeg(image_raw_data_jpg)
  6. img_data_jpg = tf.image.convert_image_dtype(img_data_jpg, dtype=tf.float32)
  7. img_1 = tf.image.flip_up_down(img_data_jpg)
  8. img_2 = tf.image.flip_left_right(img_data_jpg)
  9. img_3 = tf.image.transpose_image(img_data_jpg)
  10. plt.figure(1)
  11. plt.imshow(img_1.eval())
  12. plt.figure(2)
  13. plt.imshow(img_2.eval())
  14. plt.figure(3)
  15. plt.imshow(img_3.eval())
  16. plt.show()

输出:

tensorflow实现图像的翻转的更多相关文章

  1. NOI题库 09:图像旋转翻转变换

    NOI题库开始的题,也是略水,当然也是大水,所以彼此彼此 09:图像旋转翻转变换 总时间限制: 1000ms 内存限制: 65536kB 描述 给定m行n列的图像各像素点灰度值,对其依次进行一系列操作 ...

  2. Android Things 专题6 完整的栗子:运用TensorFlow解析图像

    文| 谷歌开发技术专家 (GDE) 王玉成 (York Wang) 前面絮叨了这么多.好像还没有一个整体的概念.我们怎样写一个完整的代码呢? 如今深度学习非常火,那我们就在Android Things ...

  3. python Tensorflow 实现图像的卷积处理

    1.convolution.py import numpy as np from sklearn.datasets import load_sample_images import tensorflo ...

  4. TensorFlow实现图像卷积并可视化示例

    图片尺寸要自己修改. 看起来好像没啥意思,不知道下一步能干什么,先卷了再说.由于weights是随机生成的(tf.random_normal作用:用于从服从指定正太分布的数值中取出随机数),所以每次卷 ...

  5. tensorflow 中图像的读取

    1. 使用gfile读入文件内容.输入的是String,输出3-D tensor.可惜的是输入不能是tensor def decode_jpg(path): r""" 读 ...

  6. TensorFlow的图像NCHW与NHWC

    import tensorflow as tf x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] with tf.Session() as sess: a = t ...

  7. TensorFlow深度学习实战---图像数据处理

    图像的亮度.对比度等属性对图像的影响非常大,这些因素都会影响最后的识别结构.当然,复杂的预处理过程可能会导致训练效率的下降(利用TensorFlow中多线程处理输入数据的解决方案). 同一不同的原始数 ...

  8. tensorflow学习笔记——图像数据处理

    喜欢摄影的盆友都知道图像的亮度,对比度等属性对图像的影响是非常大的,相同物体在不同亮度,对比度下差别非常大.然而在很多图像识别问题中,这些因素都不应该影响最后的结果.所以本文将学习如何对图像数据进行预 ...

  9. [LeetCode] Flipping an Image 翻转图像

    Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resu ...

随机推荐

  1. Leetcode总结之DFS

    package DFS; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; impo ...

  2. 【bootstrap】bootstrap中的tooltip的使用

    先看看效果图:[当光标放在下面这个时间搜索框上时,显示一段文字:搜索时间段中的流水信息] 这样的效果,怎么实现呢? 很简单 1.引入jQuery.js和bootstrap的js和css 2.给想要有t ...

  3. CheckedListBoxControl 或CheckedListBox 控件中显示水平滚动条 z

    public partial class Form1 : Form { public Form1() { InitializeComponent(); DisplayHScroll(); } /// ...

  4. Window10下Apache2.4的安装和运行

    以前用Python运行的Web框架都是要运行在Linux下,加上WSGI服务器,比如Gunicorn+Flask,后来了解到了Apache,看看能不能基于Apache这个Web服务器下给python提 ...

  5. Android的包管理机制浅析(二)

    上篇刚好说到获取到了签名信息,以下进入安装过程,直接上源代码: private void installNewPackageLI(PackageParser.Package pkg, int pars ...

  6. css3 position fixed居中的问题

    通常,我们要让某元素居中,会这样做: #element{ margin:0 auto; } 假设还想让此元素位置固定呢?一般我们会加入position:fixed,例如以下: #element{ po ...

  7. Android手机需要安装任务管理软件吗?

    使用android手机的用户可能都安装了任务管理的软件,使用android手机真的有必要安装结束任务的软件吗?大家在使用中也都发现了,很多软件在被结束后,马上就会又出现在任务列表里,或是稍等一会自己也 ...

  8. 怎样创建.NET Web Service http://blog.csdn.net/xiaoxiaohai123/article/details/1546941

    为什么需要Web Service 在通过internet网购买商品后,你可能对配送方式感到迷惑不解.经常的情况是因配送问题找配送公司而消耗你的大量时间,对于配送公司而言这也不是一项增值服务. 为了解决 ...

  9. man screen

    http://www.gnu.org/software/screen/manual/screen.html Screen User's Manual Next: Overview, Previous: ...

  10. fuser - identify processes using files or sockets

    FUSER(1) User Commands FUSER(1) NAME fuser - identify processes using files or sockets SYNOPSIS fuse ...