python - numpy shape[::-1] 中的参数 -1 是什么意思?
问题描述
numpy shape[::-1] 中的参数 -1 是什么意思?
template = cv2.imread('template.jpg',0)
w, h = template.shape[::-1]
解决方案
在这里,它与numpy无关。您正在使用 [start:end:step] 访问一个元组(有关更多详细信息,请参阅此问题),使用 -1 的步骤意味着您颠倒了顺序。
推荐阅读
- tomcat - 在 SSL CentOS 服务器上运行 Tomcat 时端口 8080 连接被拒绝
- node.js - 为什么 Express 总是返回本地 IP 地址?
- apache-spark - 使用 Pyspark 聚合两列
- graphql - 在 Nestjs/GraphQL 中使用接口时避免循环依赖
- java - 在某些时候无法使用 JNDI 和 JDBC 建立连接
- google-cloud-platform - Google 应用:Oauth 的域验证成功,但状态仍为“等待开发者操作”
- c# - 在字符串列表中查找对的最佳方法
- microsoft-graph-api - 无法使用 GRAPH 从 EXO 消息中获取 SingleValueExtendedProperties
- c - 服务器挂在 UDP 套接字的 recvfrom() 上(C,Windows)
- mediawiki - importImages.php 没有将所有文件移动到正确的子目录中