true#

class true(arr)[source]#

Returns the indices of the values of the array that are true: just an alias for arr.nonzero()[0].

Parameters:

arr (array) – any array

Example:

inds = cv.true(np.array([1,0,0,1,1,0,1])) # Returns array([0, 3, 4, 6])