OpenCV Python - Set background colour

前端 未结 5 643
囚心锁ツ
囚心锁ツ 2020-12-16 05:16

I am trying to remove a greyish background from a photo and replace it with a white one

so far I have this code:

image = cv2.imread(args[\"image\"])
         


        
5条回答
  •  一生所求
    2020-12-16 05:48

    You can use the mask to index the array, and assign just the white parts of the mask to white:

    coloured = resized.copy()
    coloured[mask == 255] = (255, 255, 255)
    

提交回复
热议问题