Skip to content Skip to sidebar Skip to footer

Numpy.where Uses

Use numpy.where to get all (R, G,B) in a numpy.array with a definite value of R, G and B The problem is i'm not sure i can use numpy.where to get what i want : i tried the followin

Solution 1:

You are looking for numpy.nonzero together with np.all (to ensure that each of RGB matches):

>>> numpy.nonzero(numpy.all(L == (1, 1, 1), axis=1))[0]
array([1, 2])

Post a Comment for "Numpy.where Uses"