@@ -38,6 +38,8 @@ BackgroundContrast::~BackgroundContrast(){}
38
38
39
39
Mat BackgroundContrast::saliencyMapGenerator ( const Mat img, const Mat fgImg, int option )
40
40
{
41
+ CV_Assert ( !(img.empty ()) );
42
+ CV_Assert ( !(option == 1 && fgImg.empty ()) );
41
43
Mat idxImg, adjcMatrix, colDistM, posDistM, bdProb, wCtr, saliency;
42
44
superpixelSplit (img, idxImg, adjcMatrix);
43
45
vector<unsigned > bdIds = getBndPatchIds (idxImg);
@@ -151,7 +153,7 @@ bool BackgroundContrast::computeSaliencyImpl( InputArray image, OutputArray sali
151
153
void BackgroundContrast::superpixelSplit ( const Mat img, Mat& idxImg, Mat& adjcMatrix)
152
154
{
153
155
Ptr<SuperpixelSEEDS> seeds;
154
- seeds = createSuperpixelSEEDS ( img.size ().width , img.size ().height , img.channels (), min (img.size ().width * img.size ().height / 600 , limitOfSP), nOfLevel, usePrior, histBin, false );
156
+ seeds = createSuperpixelSEEDS ( img.size ().width , img.size ().height , img.channels (), max ( min (img.size ().width * img.size ().height / 600 , limitOfSP), 10 ), nOfLevel, usePrior, histBin, false );
155
157
seeds->iterate( img, 4 );
156
158
Mat mask;
157
159
adjcMatrix = Mat::eye ( seeds->getNumberOfSuperpixels (), seeds->getNumberOfSuperpixels (), CV_8U );
0 commit comments