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

Function assignGMMsComponents

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

Assign GMMs components for each pixel. */

Source from the content-addressed store, hash-verified

399 Assign GMMs components for each pixel.
400*/
401static void assignGMMsComponents( const Mat& img, const Mat& mask, const GMM& bgdGMM, const GMM& fgdGMM, Mat& compIdxs )
402{
403 Point p;
404 for( p.y = 0; p.y < img.rows; p.y++ )
405 {
406 for( p.x = 0; p.x < img.cols; p.x++ )
407 {
408 Vec3d color = img.at<Vec3b>(p);
409 compIdxs.at<int>(p) = mask.at<uchar>(p) == GC_BGD || mask.at<uchar>(p) == GC_PR_BGD ?
410 bgdGMM.whichComponent(color) : fgdGMM.whichComponent(color);
411 }
412 }
413}
414
415/*
416 Learn GMMs parameters.

Callers 1

grabCutMethod · 0.85

Calls 1

whichComponentMethod · 0.80

Tested by

no test coverage detected