当前位置: 代码迷 >> 综合 >> 学习OpenCV——grabcut
  详细解决方案

学习OpenCV——grabcut

热度:1   发布时间:2024-01-13 06:26:16.0

 

GrabCut函数说明

Parameters:
  • image – Input 8-bit 3-channel image.
  • mask

    Input/output 8-bit single-channel mask. The mask is initialized by the function whenmode is set to GC_INIT_WITH_RECT. Its elements may have one of following values:

    • GC_BGD defines an obvious background pixels.
    • GC_FGD defines an obvious foreground (object) pixel.
    • GC_PR_BGD defines a possible background pixel.
    • GC_PR_BGD defines a possible foreground pixel.
  • rect – ROI containing a segmented object. The pixels outside of the ROI are marked as “obvious background”. The parameter is only used whenmode==GC_INIT_WITH_RECT .
  • bgdModel – Temporary array for the background model. Do not modify it while you are processing the same image.
  • fgdModel – Temporary arrays for the foreground model. Do not modify it while you are processing the same image.
  • iterCount – Number of iterations the algorithm should make before returning the result. Note that the result can be refined with further calls withmode==GC_INIT_WITH_MASK ormode==GC_EVAL .
  • mode

    Operation mode that could be one of the following:

    • GC_INIT_WITH_RECT The function initializes the state and the mask using the provided rectangle. After that it runsiterCount iterations of the algorithm.
    • GC_INIT_WITH_MASK The function initi