Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ python grabcut.py mts.jpg
- ===============================================================================
- Interactive Image Segmentation using GrabCut algorithm.
- This sample shows interactive image segmentation using grabcut algorithm.
- USAGE :
- python grabcut.py <filename>
- README FIRST:
- Two windows will show up, one for input and one for output.
- At first, in input window, draw a rectangle around the object using
- mouse right button. Then press 'n' to segment the object (once or a few times)
- For any finer touch-ups, you can press any of the keys below and draw lines on
- the areas you want. Then again press 'n' for updating the output.
- Key '0' - To select areas of sure background
- Key '1' - To select areas of sure foreground
- Key '2' - To select areas of probable background
- Key '3' - To select areas of probable foreground
- Key 'n' - To update the segmentation
- Key 'r' - To reset the setup
- Key 's' - To save the results
- ===============================================================================
- ** (output:18169): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-PnQnjuUEoF: Connection refused
- Instructions :
- Draw a rectangle around the object using right mouse button
- Now press the key 'n' a few times until no further change
- For finer touchups, mark foreground and background after pressing keys 0-3
- and again press 'n'
- For finer touchups, mark foreground and background after pressing keys 0-3
- and again press 'n'
- mark background regions with left mouse button
- mark background regions with left mouse button
- mark foreground regions with left mouse button
- mark background regions with left mouse button
- mark background regions with left mouse button
- Now press the key 'n' a few times until no further change
- Now press the key 'n' a few times until no further change
- For finer touchups, mark foreground and background after pressing keys 0-3
- and again press 'n'
- For finer touchups, mark foreground and background after pressing keys 0-3
- and again press 'n'
- OpenCV Error: Assertion failed (!bgdSamples.empty() && !fgdSamples.empty()) in initGMMs, file /home/mona/computer_vision/opencv-3.2.0/modules/imgproc/src/grabcut.cpp, line 379
- Traceback (most recent call last):
- File "grabcut.py", line 169, in <module>
- cv2.grabCut(img2,mask,rect,bgdmodel,fgdmodel,1,cv2.GC_INIT_WITH_MASK)
- cv2.error: /home/mona/computer_vision/opencv-3.2.0/modules/imgproc/src/grabcut.cpp:379: error: (-215) !bgdSamples.empty() && !fgdSamples.empty() in function initGMMs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement