I have a list of masks and I want to obtain the resulting mask by multiplying all of them. My Donkey Kong approach is the following:
a = [[1, 1], [1, 0], [1, 0]]
b = a[0]
for i in range(1, len(a)):
b = b * np.array(a[i])
which I think it works as returns [1,0] as value of b.
Is there a nicer way of doing this?
EDIT: I am looking for common ranges in the mask. To find all the non zero ranges I do the following: label = 0
for i in range(1, len(labels)):
label = label + np.array(labels[i])
label = [1 if x > 0 else 0 for x in label]