Advertisement
joaomlo

Correção Python

Feb 15th, 2022
629
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. #imgname = input(str)
  2. imgname = "E:\\Desktop\\CCG\\Greenshoes\\segmentation\\in\\0_mask_.png"
  3.  
  4. def PaintImageWhite(g):
  5.   image = cv.imread(g, cv.IMREAD_UNCHANGED)
  6.   altura,largura=image.shape[:2]
  7.   print(str(image.shape))
  8.   for y in range(altura):
  9.     for x in range(largura):
  10.         if image[y,x][3] == 0:
  11.           image[y,x] = [255,255,255,255]
  12.   return image
  13.  
  14. imga = PaintImageWhite(imgname)
  15.  
  16. imgClone = "E:\\Desktop\\" +"ola_clone"+".png"
  17. cv.imwrite(imgClone, imga)
  18. #cv.imshow('imga',imga)
  19.  
  20. imgc = cv.cvtColor(imga, cv.COLOR_BGRA2BGR)
  21. #cv.imshow('imgc',imgc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement