Reputation: 655
I have a 4-level 4-dimensional array contours
(result of cv2.findContours
) at the end of which I have pairs of coordinates. It looks like this:
print(contours[0][0])
→ [[ 676 4145]]
print(contours[0][0][0])
→ [ 676 4145]
print(contours[0][0][0][1])
→ 4145
I want to edit the axis element 1 of each of the last-level arrays so that the value is bigger by 10. I am aware of the documentation, but I don't know how to apply it so deep without flattening. How to do that?
Upvotes: 0
Views: 97
Reputation: 97591
Any of these would work:
contours[:,:,:,1] += 10
contours[...,1] += 10
contours += [0, 10]
Upvotes: 1