2

In Shapchat's photo editor, there is a scissor tool extract object with guiding lines (by drawing edges of object want to extract).

I wanted to implement that tool with openCV, but I am totally new to openCV. I searched openCV documents and tutorials, but I have no idea how to use and combine functions of finding contours, image moments, and edge extraction.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Paul
  • 759
  • 2
  • 7
  • 20
  • 2
    You may look at OpenCV GrabCut implementation, there are a lot of interactive demos, You can assume the inner edge of scissor line as sure foreground and outer edge as sure background and internal area of scissors as probable foreground/background, after labelling the regions, Grabcut will do the rest of work for you :) – ZdaR Aug 13 '17 at 04:57
  • @ZdaR That's what I want! Thanks! :D – Paul Aug 14 '17 at 07:02

1 Answers1

2

The easiest way to do this is:

  1. Start with OpenCV's grabcut demo here
  2. Add code to draw a polygon using mouse events, or touch events.
  3. Use the the polygon to initialize foreground region of grabcut segmentation.

You can also look at dlib's image segmentation, in which case the region cut by scissors can be used to extract parts of the segmented image.

Totoro
  • 3,398
  • 1
  • 24
  • 39