0
_, contours0, hierarchy = cv.findContours( img1, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
_, contours1, hierarchy = cv.findContours( thresh1, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
for i in contours0[0]:
     if i in contours1[0]:
        contours0[0].delete(i)
print(contours0)

This yields AttributeError: numpy.ndarray object has no attribute delete What could be the error? I want to remove matching elements from contour.

sebasgo
  • 3,845
  • 23
  • 28
  • numpy arrays do not have a `delete()` method. Instead, you have to use `numpy.delete(contours0[0], index)` where `index` is the position of `i` – Shinra tensei Feb 14 '18 at 09:39
  • 3
    Possible duplicate of [How to remove specific elements in a numpy array](https://stackoverflow.com/questions/10996140/how-to-remove-specific-elements-in-a-numpy-array) – jpp Feb 14 '18 at 10:01

0 Answers0