Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

That means that the mask that you are passing is having some points which is not having one of the four values specified for the mask to be passed in grabcut function.

When you use Imgproc.GC_INIT_WITH_MASK you should have the mask with any of the four values. For case when you use Imgproc.GC_INIT_WITH_RECT you can have an empty mask also.

So for solving your problem make sure that your mask has either 0,1,2 or 3 meaning background, foreground, probable background, probable foreground respectively.