row,col = 4000, 4000
a =np.zeros((row*col,6))
k=0
for i in range(row):
for j in range(col):
if k<len(a):
a[k, 1:3]= [i,j] #Put pixsel coordinates in even rows -- 1. and 2. columns.
k = k + 2
有一张40004000大小的图像,我想迭代每个点的像素坐标(迭代大小)。我像上面一样做了。但是图像大小很大,这个过程需要很多时间。有没有更有效的方法
Tags:
这可以在不循环的情况下完成,但是我不清楚为什么只返回一半行上的坐标,即在我的示例中,最后一个非零行是坐标(4,9),因此在pix()中,行被设置为5而不是10
原始功能:
具有循环的新功能:
比较:
性能:
pix()的输出:
相关问题 更多 >
编程相关推荐