我已经看到np.int0
用于在OpenCV问题中将边界框浮点值转换为int。
什么是np.int0
?
我见过np.uint8
,np.int32
等。我似乎无法在任何在线文档中找到np.int0
。这会引发什么样的int参数?
它只是int64
的别名,可以从Python 2或Python 3中尝试:
>>> import numpy
>>> numpy.int0 is numpy.int64
True
以下是一些更多信息:
# get complete list of datatype names
>>> np.sctypeDict.keys()
# returns the default integer type (here `int64`)
>>> np.sctypeDict['int0']
<class 'numpy.int64'>
# verify
>>> arr = np.int0([1, 2, 3])
>>> arr.nbytes
24