Hi,
I am using a background substraction with the following code in a class:
void process(const cv::Mat &inputFrame)
{
// class members:
//cv::Ptr pMOG2;
//cv::Mat foregroundMaskMOG2;
//bool backgroundSubstractorCreated=false;
//creates one background subtractor object per instance
if( backgroundSubstractorCreated==false)
{
pMOG2 = cv::createBackgroundSubtractorMOG2(10,250,false);
backgroundSubstractorCreated=true;
}
//update the background model
std::cout <<"here" <apply(inputFrame, foregroundMaskMOG2,0); //Background not updated = 0
std::cout <<"it hangs" <
↧