im using numpy 2d arrays. I want to copy values from one array to another array, but only if an expression is true.
e.g.
for row in range(len(anImage1)):
for col in range(len(anImage1[0])):
if col > 100:
anImage1[row][col] = min(anImage1[row][col], anImage2[row][col])
or
for row in range(len(anImage1)):
for col in range(len(anImage1[0])):
if anImageMask[row][col] == 255:
anImage1[row][col] = anImage2[row][col]
I know this is a very poor and slow solution... Can somebody explain me how to speed up the code?