Commit b2f4affb authored by jaco's avatar jaco

templateReplacement function completed

parent 9a196a9c
......@@ -120,7 +120,7 @@ class CV_EXPORTS_W MotionSaliencyBinWangApr2014 : public MotionSaliency
// Background model maintenance functions
bool templateOrdering();
bool templateReplacement( Mat finalBFMask, Mat image );
bool templateReplacement( const Mat& finalBFMask, const Mat& image );
// Decision threshold adaptation and Activity control function
//bool activityControl(vector<Mat> noisePixelMask);
......
......@@ -156,29 +156,33 @@ int main( int argc, char** argv )
}
else if( saliency_algorithm.find( "BinWangApr2014" ) == 0 )
{
Ptr<Size> size= Ptr<Size>( new Size( 32, 32 ) ) ;
saliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->setWsize(size);
// TODO INSERT CAPTURE CICLE FOR MOTION
//int testSize = 34;
//Ptr<Size> size = Ptr<Size>( new Size( testSize, testSize ) );
Ptr<Size> size = Ptr<Size>( new Size( image.cols, image.rows ) );
saliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->setWsize( size );
saliencyAlgorithm.dynamicCast<MotionSaliencyBinWangApr2014>()->init();
// Create an fake image test
Mat test( 32, 32, CV_8U );
/* // Create an fake image test
Mat test( testSize, testSize, CV_8U );
RNG rand;
for(int i=0; i<test.rows; i++)
for(int j=0; j<test.cols; j++)
for ( int i = 0; i < test.rows; i++ )
{
if(i<12 && i>=6 && j<12 && j>=6)
test.at<uchar>(i,j)=255;
for ( int j = 0; j < test.cols; j++ )
{
if( i < 6 && i >= 0 && j < 34 && j >= 28 )
test.at<uchar>( i, j ) = 255;
else
test.at<uchar>(i,j)=rand.uniform(40,60);
test.at<uchar>( i, j ) = rand.uniform( 40, 60 );
}
} */
//imshow("Test", test);
//waitKey(0);
Mat saliencyMap;
if( saliencyAlgorithm->computeSaliency( test, saliencyMap ) )
if( saliencyAlgorithm->computeSaliency( image /*test*/, saliencyMap ) )
{
std::cout<<"motion saliency done"<<std::endl;
std::cout << "motion saliency done" << std::endl;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment