-1

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

template = cv2.imread('template.jpg',0)
w, h = template.shape[::-1]
zinon
  • 4,427
  • 14
  • 70
  • 112

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
  • 2,385
  • 4
  • 19
  • 32