python numpy教程_python读取图片尺寸

python numpy教程_python读取图片尺寸pythonnumpy图片pad参数详解

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

python numpy 图片 pad 参数详解

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

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

mode : str or function, optional
    One 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)

在这里插入图片描述

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/170273.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • Navicat Premium 15generate生成激活码失败_通用破解码

    Navicat Premium 15generate生成激活码失败_通用破解码,https://javaforall.cn/100143.html。详细ieda激活码不妨到全栈程序员必看教程网一起来了解一下吧!

  • 如何使vmware虚拟机中的Redflag Linux操作系统能够上网?

    如何使vmware虚拟机中的Redflag Linux操作系统能够上网? 第一种情况:主机使用PPPOE拨号上网方法一:NAT方式1、先关闭虚拟机中的操作系统,回到虚拟机主界面双击主界面右上方的的“Ethernet”,弹出“NetworkAdapter”对话框,选择“NAT”2、启动虚拟机操作系统,设置IP为动态获取,即通过DHCP获得。此时虚拟机中的操作系统用的是主机的IP,主机能够上网,那么虚拟机也能。方法二:Host-only方式1

  • ajax最常见的几种面试题

    ajax最常见的几种面试题1,什么是ajax?请谈一下你对ajax的认识AJAX是“AsynchronousJavaScriptandXML”的缩写。他是指一种创建交互式网页应用的开发技术。ajax包含下列技术:基于web标准XHTML+CSS表示;使用dom进行动态显示及交互;使用xml和xslt进行数据交换及相关操作;使用xmlhttprequest进行异步数据查询,检索;使用Java…

  • c++语言switch用法举例_switch语句特点

    c++语言switch用法举例_switch语句特点C语言/C++【switch语句详解(用法、规则、流程图、实例)】

  • gridlayout java_Java GridLayout

    gridlayout java_Java GridLayoutJavaGridLayout1JavaGridLayout的介绍GridLayout用于将组件排列在矩形网格中。每个矩形中显示一个组件。2JavaGridLayout的构造方法构造方法描述GridLayout()创建一个网格布局,其中每个组件一行一行。GridLayout(introws,intcolumns)使用给定的行和列创建网格布局,但组件之间没有间隙。GridLayout(…

  • hash 哈希算法_哈希一致性算法

    hash 哈希算法_哈希一致性算法文章目录一、哈希函数定义特点应用常见哈希算法二、murmurhash定义特点应用介绍三、MurmurHash使用四、性能测试MurmurHash:(multiplyandrotate)and(multiplyandrotate)Hash,乘法和旋转的hash算法。一、哈希函数定义散列函数(英语:Hashfunction)又称散列算法、哈希函数,是一种从任何一种数据中创建小的数字“指纹”的方法。散列函数把消息或数据压缩成摘要,使得数据量变小,将数据的格式固定下来。该函数将数据打乱混合

    2022年10月18日

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号