I need to understand the usage of operators in the following python code snippet. I'm not familiar with the usage of * in the np.zeros() statement. It looks like the pointer dereferencing operator in c, but I'm guessing not.
Also, what is the usage of ==
in the assignment statement? This looks like an equality test, but True
and False
are not valid indexes into a numpy array.
new_segs = np.zeros((*raw_segs.shape, 3), dtype=np.uint8)
i = 0
for val in [x['handle'] for x in detections]:
colors = [(255,0,255), (55,0,55), (34,33,87)]
new_segs[raw_segs == val] = colors[i % len(colors)]
Sorry for the crappy question. Have tried looking for answers but I get unsatisfactory answers with searches on operator usage.