GrabCut
GrabCut copied to clipboard
An implementation of http://dl.acm.org/citation.cfm?id=1015720
GrabCut
An implementation of "GrabCut": interactive foreground extraction using iterated graph cuts.
Under GNU General Public License.
Dependency
- OpenCV
- Python3-cv2
- numpy
Usage
- Download all the files and extract to someplace;
- Input in the command line: python3 grabcut.py (image) (number of iterations) (number of components in each GMM);
- Use right mouse button to drag a rectangle to select the targeting object.
- Press N on the keyboard to start grbcutting;
- If user interaction is necessary, press each of the buttons listed below, and use left mouse button to draw points on the ORIGINAL image, then press N to continue.
Button | Function |
---|---|
'1' | Mark Background |
'2' | Mark Probable Background |
'3' | Mark Probable foreground |
'0' | Mark Foreground |
's' | Save image, which would be saved as 'img_name_gc.jpg' |
'r' | Reset the process |