0 followers · 0 following
Python CLI wrapped for grabCut algorithm as compiled into OpenCV.
grabCut is an algorithm which takes an image and a region you promise to contain the foreground, and tries to pull out the foreground. It's pretty good. It's the background removal tool from microsoft office.
Made on request of Antonio Roberts AKA HelloCatFood (https://www.hellocatfood.com/).
|
seventeenmagpie
950f6ba313
Merge pull request 'added descriptions to positional arguments? idk how to describe it' ( #1 ) from hellocatfood/grabcut-python-cli:main into main
Reviewed-on: #1 Reviewed-by: seventeenmagpie <seventeenmagpie@noreply.codeberg.org> |
||
|---|---|---|
| grabcut.py | added descriptions to positional arguments? idk how to describe it | |
| README.md | added descriptions to positional arguments? idk how to describe it | |
3rd party python packages required:
- numpy,
- OpenCV, Both on pip. Deal with your environments the way you like.
Example usage: python grabcut.py input.jpg -x 50 -y 150 --width 350 --height 320 --output output.png --crop
Input filename, x, y, width, height are all positional (mandatory) arguments. Output filename is an optional argument (default behaviour is to overwrite input filename). Crop toggles whether the output image should be cropped to the extent of the detected foreground.
Coordinates are using computer graphics convention, so x and y is from top left corner of image.
Have fun! Let me know if any problems and I'll see what I can do.
Made with love by Mags (https://mags.omg.lol) in 2025.