numpy shape [::-1]中的参数-1是什么意思?

时间:2018-11-21 12:24:35

标签: python numpy

numpy shape [::-1]中的参数-1是什么意思?

template = cv2.imread('template.jpg',0)
w, h = template.shape[::-1]

1 个答案:

答案 0 :(得分:1)

在这里,它与numpy无关。您正在使用[start:end:step](有关更多详细信息,请参见this question)访问元组,使用步骤-1表示您颠倒了顺序。