1
0
Fork
You've already forked grabcut-python-cli
0
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/).
  • Python 100%
2026年01月07日 14:51:14 +00:00
grabcut.py added descriptions to positional arguments? idk how to describe it 2026年01月07日 14:51:14 +00:00
README.md added descriptions to positional arguments? idk how to describe it 2026年01月07日 14:51:14 +00:00

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.