在OpenCV问题中,我见过np.int0
用于将边界框浮点值转换为整型。
np.int0
到底是什么?
我见过np.uint8
、np.int32
等,但似乎在任何在线文档中都找不到np.int0
。这个强制转换的参数是什么类型的int?
发布于 2018-01-20 06:57:17
发布于 2018-01-20 06:55:07
它仅仅是int64
的别名,在Python2或Python3中试试:
>>> import numpy
>>> numpy.int0 is numpy.int64
True
发布于 2018-01-20 10:25:13
以下是更多信息:
# 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
https://stackoverflow.com/questions/48350693
复制相似问题