0

I'm making an android application with opencv that involves cutting images by hand and I'm having a problem. I recover the points that the user makes with his hand on the screen and then I apply a mask on the original image to get the part that the user wants. My concern is that when the user does not finish the drawing correctly, you can end up with a big line that goes from the last point to the first point. I would like, as a snapchat, to be able to make a cut without completely following the user's path but by surrounding his path.

For the moment I use the following functions :

        Imgproc.fillPoly(mask,pts,new Scalar(255,255,255,255));
        Core.bitwise_and(img, mask, dst);

pts are the points that the user sends after the plot. img is the basic image example

Dan Mašek
  • 17,852
  • 6
  • 57
  • 85
  • 1
    Can you elaborate more on how this should behave for various input shapes? e.g. what if user makes a `C` or `E` shaped selection and gets the start and end points quite close to each other? With the current example, maybe convex hull would be a decent starting point... – Dan Mašek Mar 12 '19 at 16:49
  • Yes, that's what I was looking for, thank you ! – Marvyn O'Rourke Mar 22 '19 at 10:24

0 Answers0