rembg
rembg copied to clipboard
[BUG] PNG with transparency is unprocessable with `-a -ae 15` flags
PNG with some transparency is unprocessable with -a -ae 15 flags.
Traceback (most recent call last):
File "/usr/local/bin/rembg", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/rembg/cli.py", line 88, in i
output.write(remove(input.read(), session=new_session(model), **kwargs))
File "/usr/local/lib/python3.9/dist-packages/rembg/bg.py", line 116, in remove
cutout = alpha_matting_cutout(
File "/usr/local/lib/python3.9/dist-packages/rembg/bg.py", line 52, in alpha_matting_cutout
alpha = estimate_alpha_cf(img_normalized, trimap_normalized)
File "/usr/local/lib/python3.9/dist-packages/pymatting/alpha/estimate_alpha_cf.py", line 53, in estimate_alpha_cf
L = cf_laplacian(image, **laplacian_kwargs, is_known=is_known)
File "/usr/local/lib/python3.9/dist-packages/pymatting/laplacian/cf_laplacian.py", line 168, in cf_laplacian
_cf_laplacian(image, epsilon, radius, values, indices, indptr, is_known)
File "/usr/local/lib/python3.9/dist-packages/pymatting/laplacian/cf_laplacian.py", line 8, in _cf_laplacian
assert d == 3
AssertionError
Steps to reproduce the behavior:
- You have a square PNG image with any transparency in it, named
1.pngin /YOUR_DIR. docker run -it --rm --name rembg_test -w "/app" -v "/YOUR_DIR:/app" danielgatis/rembg i -a -ae 15 1.png 2.png
OS Version: docker on linux
Rembg version: danielgatis/rembg:latest
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.