Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from rembg import remove
- from PIL import Image
- import cv2
- source = "111.jpg"
- dest_pil = "222.png"
- dest_rembg = "333.png"
- dest_cv2 = "444.png"
- print("PIL")
- input = Image.open(source)
- output = remove(input)
- output.save(dest_pil)
- print("rembg")
- with open(source, 'rb') as i:
- with open(dest_rembg, 'wb') as o:
- input = i.read()
- output = remove(input)
- o.write(output)
- print("cv2")
- input = cv2.imread(source)
- output = remove(input)
- cv2.imwrite(dest_cv2, output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement