I have image numpy array (640,480,3) where X,Y is coordinates and (255 255 255) is a color mask for point
I try to get new 2d array(x,y), where X and Y is coordinates for point when color > zero..
I try this code
and it works, but it takes too much processor time
enter code here
for x in range(edges.shape):
for y in range(edges.shape):
You could slice the first element of last axis, compare it against
0 and then use
np.argwhere to get those indices, which would be the
y coordinates in a
(N,2) shaped array.
Thus, the implementation would be simply -
new = np.argwhere( edges[...,0]!=0 )