MCPcopy Create free account
hub / github.com/creatale/node-dv / estimateSegmentation

Function estimateSegmentation

deps/opencv/modules/imgproc/src/grabcut.cpp:509–526  ·  view source on GitHub ↗

Estimate segmentation using MaxFlow algorithm */

Source from the content-addressed store, hash-verified

507 Estimate segmentation using MaxFlow algorithm
508*/
509static void estimateSegmentation( GCGraph<double>& graph, Mat& mask )
510{
511 graph.maxFlow();
512 Point p;
513 for( p.y = 0; p.y < mask.rows; p.y++ )
514 {
515 for( p.x = 0; p.x < mask.cols; p.x++ )
516 {
517 if( mask.at<uchar>(p) == GC_PR_BGD || mask.at<uchar>(p) == GC_PR_FGD )
518 {
519 if( graph.inSourceSegment( p.y*mask.cols+p.x /*vertex index*/ ) )
520 mask.at<uchar>(p) = GC_PR_FGD;
521 else
522 mask.at<uchar>(p) = GC_PR_BGD;
523 }
524 }
525 }
526}
527
528void cv::grabCut( InputArray _img, InputOutputArray _mask, Rect rect,
529 InputOutputArray _bgdModel, InputOutputArray _fgdModel,

Callers 1

grabCutMethod · 0.85

Calls 2

maxFlowMethod · 0.80
inSourceSegmentMethod · 0.80

Tested by

no test coverage detected