opencv: cv2.flip 图像翻转 进行 数据增强
来源:互联网 发布:达内培训 it外企it 编辑:程序博客网 时间:2024/05/29 03:51
Syntax
flip(src, flipCode[, dst])
args
Demo
Original Image 原图像:
Flipped Horizontally 水平翻转:
Flipped Vertically 垂直翻转:
Flipped Horizontally & Vertically 水平垂直翻转:
Code
# encoding:utf-8import cv2image = cv2.imread("girl.jpg")# Flipped Horizontally 水平翻转h_flip = cv2.flip(image, 1)cv2.imwrite("girl-h.jpg", h_flip)# Flipped Vertically 垂直翻转v_flip = cv2.flip(image, 0)cv2.imwrite("girl-v.jpg", v_flip)# Flipped Horizontally & Vertically 水平垂直翻转hv_flip = cv2.flip(image, -1)cv2.imwrite("girl-hv.jpg", hv_flip)
Appendix
也可打开 help 功能 具体查看 接口设置:
$ pythonPython 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49) [GCC 7.2.0] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import cv2>>> help(cv2.flip)Help on built-in function flip:flip(...) flip(src, flipCode[, dst]) -> dst . @brief Flips a 2D array around vertical, horizontal, or both axes. . . The function cv::flip flips the array in one of three different ways (row . and column indices are 0-based): . \f[\texttt{dst} _{ij} = . \left\{ . \begin{array}{l l} . \texttt{src} _{\texttt{src.rows}-i-1,j} & if\; \texttt{flipCode} = 0 \\ . \texttt{src} _{i, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} > 0 \\ . \texttt{src} _{ \texttt{src.rows} -i-1, \texttt{src.cols} -j-1} & if\; \texttt{flipCode} < 0 \\ . \end{array} . \right.\f] . The example scenarios of using the function are the following: . * Vertical flipping of the image (flipCode == 0) to switch between . top-left and bottom-left image origin. This is a typical operation . in video processing on Microsoft Windows\* OS.:
阅读全文
1 0
- opencv: cv2.flip 图像翻转 进行 数据增强
- 图像数据增强,最好是用cv2去实现目的
- opencv: 图像缩放(cv2.resize)
- OpenCV 图像的翻转 flip实现 与遍历像素的方式实现
- flip、transpose 图像翻转镜像
- opencv 图像翻转、旋转
- OPENCV 图像翻转
- OpenCV实现图像翻转
- opencv 灰度图像增强
- opencv-图像增强
- opencv图像增强demo
- OpenCV笔记 图像增强
- opencv Mat 图像数据元素进行排序
- opencv-图像反转和翻转
- 【OpenCV3】图像翻转——cv::flip()详解
- OpenCV 图像反色 垂直翻转图像
- opencv 彩色图像对比度增强
- OpenCV直方图图像增强算法
- sql语言:DQL、DML、DDL、DCL
- 欢迎使用CSDN-markdown编辑器
- 修改jar中包结构,修改jar包包名
- 虽然很短暂,但也曾经有过
- sqlite数据库在Python中的使用简介
- opencv: cv2.flip 图像翻转 进行 数据增强
- 基于kotlin实现的简单个人账户管理APP
- tomcat设置使得url省去项目名称
- MNISTone----用的softmax
- 安装windows系统
- 分析Ajax请求并爬取下载今日头条街拍美图
- 计数排序
- python 从一系列字符串中,找出频率最高的字符串
- Android Alpha换算表