-1

What does the parameter -1 in numpy shape[::-1] mean?

template = cv2.imread('template.jpg',0)
w, h = template.shape[::-1]
zinon
  • 4,077
  • 11
  • 64
  • 99

1 Answers1

2

Here, it has nothing to do with numpy. You are accessing a tuple with [start:end:step] (see this question for more details), using a step of -1 means you reverse the order.

cheersmate
  • 1,800
  • 4
  • 15
  • 26