I am busy converting and interpreting software used in previous years of my final year project. I would just like to check if it is possible to define a background model in a header file, as i am currently getting an error.
class CWaterFill
{
public:
void Initialise();
Mat ContourFilter(Mat Img, int minSize);
Mat superminImg;
protected:
BackgroundSubtractorMOG2 m_bg_model;//Define the background model.
};
It is then used in the .cpp file in the following function:
void CWaterFill::GMM2(Mat InputImg, int nFrame, double learnRate)
{
m_bg_model(InputImg, m_fgmask, learnRate);//m_fgmask outlook is
}
Use a pointer to an abstract BackgroundSubtractor
object:
...
protected:
cv::Ptr<BackgroundSubtractor> m_bg_model;//Define the background model.
And then create the concrete type, e.g.:
m_bg_model = createBackgroundSubtractorMOG2(20, 16, true);