Where I get the following result (i.e. packaging is also removed):
Does anyone have any idea on what to do to obtain the same result?
CodePudding user response:
- you should sharpen the image first (use strong sharpen)
from PIL import Image
from PIL import ImageFilter
from PIL.ImageFilter import (UnsharpMask)
simg = Image.open('data/srcimg07.jpg')
dimg = simg.filter(UnsharpMask(radius=4.5, percent=200, threshold=0))
dimg.save("result/ImageFilter_UnsharpMask_2_150_3.jpg")
- use U2Net to remove the background of the sharpened image
- use the result from step (2) as mask
- using the mask from step (3) extract wanted result from original picture
note: this is very quick example, you could refine it more