When testing if a numpy array c
is member of a list of numpy arrays CNTS
:
import numpy as np
c = np.array([[[ 75, 763]],
Use del
to delete the index of the list you want to remove.
del CNTS[int(np.where(list(np.array_equal(row, c) for row in CNTS))[0])]
CNTS
[array([[[ 78, 1202]],
[[ 63, 1202]],
[[ 63, 1187]],
[[ 78, 1187]]]), array([[[ 72, 742]],
[[ 58, 742]],
[[ 57, 741]],
[[ 57, 727]],
[[ 58, 726]],
[[ 72, 726]]]), array([[[ 66, 194]],
[[ 51, 194]],
[[ 51, 179]],
[[ 66, 179]]])]