Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

img_rgb is a numpy ndarray.

To find indices of the mask

indices = np.where(mask==255)

To fill pixels at these indices with red color

img_rgb[indices[0], indices[1], :] = [0, 0, 255]

img_rgb now has red pixels