The grabcut algorithm is giving me a defect in the image segmentation. The input image is:
The result is:
Basic code for grabcut:
border_offset = 10 bgdModel = np.zeros((1, 65), np.float64) fgdModel = np.zeros((1, 65), np.float64)
rect = (border_offset,border_offset,img_size[0]-border_offset,img_size[1]-border_offset)
cv.grabCut(img,mask,rect,bgdModel,fgdModel,3,cv.GC_INIT_WITH_RECT)
Changing the border offset results in smaller or larger defects. The defect is always in the bottom right corner.
When I change the size of the image the result is different but not correct. The border is rough and the image is clipped.
Any suggestions ?