小编Dev*_*per的帖子

如何索引numpy数组python的倒数第二行

我想索引一个 numpy 数组的倒数第二行我有一个不断追加新行的循环:

arr2= is an array formatted like so [[300 240 22 22]] 
Run Code Online (Sandbox Code Playgroud)

所以在上面的例子中 x=300 y=240 w=22 h=22
这些数字在等式中得到处理,直到 wm 有 2 个数字,所以 [200, 300] 和 hm 也有 2 个数字 [200, 300] 并且都是 NON -STOP 附加到 arr 的末尾(不是创建新数组,而是添加到单个数组。所以它看起来像这样不断添加新行(我不知道它实际上是添加新行还是覆盖旧行)值):

----row [[301.77325 225.71806][366.08594 232.20958]]
----row [[301.54193 225.93848][365.76663 232.37358]]
---- [[300.9011  225.27153][365.21063 231.52242]]second to last appended 
row 
---- [[300.63205 223.20387][364.91928 229.46263]]last appended row
then there would be another row being appended this is just a snapshot
Run Code Online (Sandbox Code Playgroud)

代码:

arr=[] #shape is (0,)
for …
Run Code Online (Sandbox Code Playgroud)

python arrays indexing numpy computer-vision

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

arrays ×1

computer-vision ×1

indexing ×1

numpy ×1

python ×1