草庐IT

componentsCount

全部标签

c++ - OpenCV - 具有自定义前景/背景模型的 GrabCut

我想使用在OpenCV上实现的GrabCut算法。如documentation所示这是函数签名:voidgrabCut(InputArrayimg,InputOutputArraymask,Rectrect,InputOutputArraybgdModel,//*InputOutputArrayfgdModel,//*intiterCount,intmode=GC_EVAL)mode参数,指示如何初始化算法,使用rect(矩形边界框)或使用ma​​sk(一个矩阵,其值对应于前景/背景区域的用户绘画。我已经有了FG和BG的颜色模型,所以理想情况下我不需要提供mask或矩形,而是使用这些模