android python 纠正图片,图像预处理方法在android上的实现

一、互动环节:In [168]: np.source(np.expand_dims)

In file: /usr/local/lib/python3.5/dist-packages/numpy/lib/shape_base.py

def expand_dims(a, axis):

"""

.... docs

"""

a = asarray(a)

shape = a.shape

if axis > a.ndim or axis < -a.ndim - 1:

# 2017-05-17, 1.13.0

warnings.warn("Both axis > a.ndim and axis < -a.ndim - 1 are "

"deprecated and will raise an AxisError in the future.",

DeprecationWarning, stacklevel=2)

# When the deprecation period expires, delete this if block,

if axis < 0:

axis = axis + a.ndim + 1

# and uncomment the following line.

# axis = normalize_axis_index(axis, a.ndim + 1)

return a.reshape(shape[:axis] + (1,) + shape[axis:])

所以基本上它使用reshape,形状在正确的位置包含一个大小1维。这也可以用[:,:,np.newaxis,...]语法完成。在

其中任何一个是否可移植到Java取决于该语言中的数组实现。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值