python numpy 图片 pad 参数详解

‘constant’, ‘edge’, ‘linear_ramp’, ‘maximum’, ‘mean’, ‘median’, ‘minimum’, ‘reflect’, ‘symmetric’, ‘wrap’, ‘empty’
光看文档不太好理解,因为在网上找不到详细的例子,所以我就自己动手做了一个例子。
如果觉得有收获,欢迎收藏小店哦,感谢<||>

为了更好的演示,我剪裁了原图右边和下边的留白区域。

mode : str or function, optionalOne of the following string values or a user supplied function.'constant' (default)Pads with a constant value.'edge'Pads with the edge values of array.'linear_ramp'Pads with the linear ramp between end_value and the array edge value.'maximum'Pads with the maximum value of all or part of the vector along each axis.'mean'Pads with the mean value of all or part of the vector along each axis.'median'Pads with the median value of all or part of the vector along each axis.'minimum'Pads with the minimum value of all or part of the vector along each axis.'reflect'Pads with the reflection of the vector mirrored on the first and last values of the vector along each axis.'symmetric'Pads with the reflection of the vector mirrored along the edge of the array.'wrap'Pads with the wrap of the vector along the axis. The first values are used to pad the end and the end values are used to pad the beginning.'empty'Pads with undefined values.
modes = ['constant', 'edge', 'linear_ramp', 'maximum', 'mean', 'median', 'minimum', 'reflect', 'symmetric', 'wrap', 'empty' ]
pic = cv2.imread('D:/share/QRcode/taobao.jpg')
pic = cv2.cvtColor(pic, cv2.COLOR_BGR2RGB)
plt.figure(figsize=(500,120))
plt.subplot(12,1,1)
plt.title('Raw(Cut right and down side)')
plt.imshow(pic)
for index, mode in enumerate(modes):plt.subplot(12,1,index+2)pic_pad = np.pad(pic, ((100,100), (100,100), (0,0)) , mode)plt.title(mode)plt.imshow(pic_pad)plt.title(mode)plt.imshow(pic_pad)

python numpy 图片 pad 参数详解相关推荐

  1. python u_对python 命令的-u参数详解

    缘起: 今天在看arcface的训练代码,在shell脚本中运行python 命令时后面加了-u 参数(python -u xx.py),于是对这个参数进行了下小研究. 准备知识 用网上的一个程序示例 ...

  2. 零基础学Python:函数的参数详解

    必备参数 关键字参数 默认参数 不定长参数 1 必需的参数: 必须参数须以正确的顺序传入函数,调用的数量必须和声明时的一样 def f(name,age):print('I am %s,I am %d ...

  3. python中cv2.putText参数详解

    cv2.putText(img, str(i), (123,456)), font, 2, (0,255,0), 3) 各参数依次是:图片,添加的文字,左上角坐标,字体,字体大小,颜色,字体粗细 其中 ...

  4. 四、Python中scatter函数参数详解

    最近开始学习Python编程,遇到scatter函数,感觉里面的参数不知道什么意思于是查资料,最后总结如下: 1.scatter函数原型 2.其中散点的形状参数marker如下: 3.其中颜色参数c如 ...

  5. Python中scatter函数参数详解

    最近开始学习python编程,遇到scatter函数,感觉里面的参数不知道什么意思于是查资料,最后总结如下: 1.scatter函数原型 2.其中散点的形状参数marker如下: 3.其中颜色参数c如 ...

  6. python numpy array转置_详解Numpy数组转置的三种方法T、transpose、swapaxes

    Numpy是高性能科学计算和数据分析的基础包,里面包含了许多对数组进行快速运算的标准数学函数,掌握这些方法,能摆脱数据处理时的循环. 1.首先数组转置(T) 创建二维数组data如下: 进行矩阵运算时 ...

  7. python numpy库安装winerror5_详解idea从git上拉取maven项目详细步骤

    刚从Eclipse转Intellij,对于它的各种操作也是一脸懵逼,但觉得使用起来还不错,今天就说一下我用Idea导入git中的Maven项目的详细步骤: 1. 首先打开Intellji Idea,选 ...

  8. python numpy 子数组_详解:Python 取numpy数组的某几行某几列方法(含对与错示例)...

    前言: 今天为大家带来的内容是Python 取numpy数组的某几行某几列方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,要是喜欢的话记得点赞转发收藏不迷路哦!!! ...

  9. python直方图hist用法参数详解

    https://www.cnblogs.com/python-life/articles/6084059.html

  10. Python从图片获得文字详解过程 可实现

    欢迎小伙伴的点评✨✨,相互学习.互关必回.全天在线

最新文章

  1. https://blog.csdn.net/blmoistawinde/article/details/84329103
  2. CC2540开发板学习笔记(一)——LED点亮
  3. html性别选项卡,html选项卡
  4. Zigbee无限数据传输模块在无线个域网有什么作用?
  5. 客服顾问的工具箱--走出软件作坊:三五个人十来条枪 如何成为开发正规军(六)[转]...
  6. Qt工作笔记-通过 对象树 或 delete this 释放对象
  7. 创建设计模式 - Builder设计模式
  8. 解决nginx反向代理缓存不起作用的问题
  9. 测试过程中常用的linux命令之【删除指定的文件行】
  10. OA系统四级模块编写测试用例(角色模块)
  11. python 开发管理软件 ERP
  12. 8. SpringBoot基础学习笔记
  13. 对百词斩可可英语的测试
  14. Weblogic10.3_Windows优化设置
  15. IE8打不开网页提示sysfader错误的解决办法
  16. 开源授权协议GPL和LGPL的区别
  17. PHP中间件是什么?
  18. unexpected EOF while parsing是什么意思
  19. 【技法操作】UI界面设计,用PS设计运动页面教程
  20. ILP——指令级并行2:记分牌(Scoreboard)技术

热门文章

  1. 真人踩过的坑,告诉你避免自动化测试常犯的10个错误
  2. 【版权】软著和专利的申请过程
  3. 10.27 正睿提高9
  4. 这个Python自动扫雷算法写完了,估计看懂的人十不存一了吧
  5. 工具类之十七 基于zxing的二维码生成工具类
  6. 【转】理解分布式账本技术: 经济学视角
  7. PS如何修改gif动图 播放速度 - 本地方法篇
  8. 山东养殖业稳中有升,饲料企业较乐观
  9. J.U.C之AQS:CLH同步队列
  10. 温泉PHP网络授权系统,温泉PHP授权系统验证系统完整开源