Skip to content

Latest commit

 

History

History
70 lines (50 loc) · 2.94 KB

README.md

File metadata and controls

70 lines (50 loc) · 2.94 KB

Grabcut

Labeling tool for machine vision based segmentation, based on work by Kris Kitani

Dependencies

IDE

This project is ported to work in Apple's Xcode; it tested with Xcode 7.3.1.

This project also uses the OpenCV library; it is tested with Versions or 2.4.12 and 2.4.13.

Installing OpenCV on OS X

Two ways to install OpenCV on OS X; we recommend the first:

  1. Use Homebrew, from the terminal:
brew update
brew tap homebrew/science
brew install opencv
* Note: Make sure OpenCV's dependencies are also installed, you can check using `brew info opencv`
  1. Download OpenCV and building it using cMake * This tutorial provides greater detail for setting up OpenCV with cMake and Xcode.

Project Installation

To install the Grabcut project, complete the following steps:

  1. Clone this repository:
git clone with https://github.com/cmuartfab/grabcut.git`
  1. Double click grabcut.xcodeproj to open it in Xcode

  2. Navigate to the /usr/local/lib directory and select all of the libopencv.dylib files and drag and drop them into the lib folder in the Xcode project. You should see all the libopencv.dylib files in the Grabcut project lib folder.

  3. In the Xcode project's build settings Under targets on the left column, select grabcut.

  4. Make sure the paths under Library Search Paths inclure the directory where OpenCV is installed on your machine. If you used Homebrew to install OpenCV, it should be in usr/local/Cellar

Running the Xcode project

  1. Double click grabcut.xcodeproj to open it in Xcode
  2. grabcut/main.cpp, update this line with the right path to the datasets folder
string root = "/xxx/dataset/";	//Update this line to point to your dataset folder
  1. To label and generate masks for new images, add new images to 'dataset/img/ASAP/' and name them using names with the format 00000xxx.jpg, starting at 101, like this:
00000101.jpg
00000102.jpg
00000103.jpg
...
  1. Label the foreground and background with the following keys:
  • 'b' - Background Mode: using the mouse, draw Green lines on the background, outlining the foreground object (see top left of image below)
  • 'f' - Foreground Mode: using the mouse, draw Red lines within the outline of the foreground object (see top left of image below)
  • 'd' - Done: moves to the next image
  • 'r' - Reset: resets current image

alt tag

  • Top Left: Green background and red foreground lines
  • Top Right: Foreground background separation; Foreground in pulple, and background in green
  • Bottom Left: calculated mask
  • Bottom Right: Mask applied to original source image