/* * ObservationGenerator.hpp * * Created on: Apr 2, 2020 * Author: lukas */ #ifndef OBSERVATIONGENERATOR_H #define OBSERVATIONGENERATOR_H #include "opencv2/opencv.hpp" using namespace cv; using namespace std; /** * Structure to save blob parameters. */ struct cvBlob { int ID; /* blob ID */ int x, y; /* blob position */ int w, h; /* blob sizes */ }; class ObservationGenerator { public: ObservationGenerator(); virtual ~ObservationGenerator(); int generateObservation(Mat frame, Mat &observation); void doBackGroundSubstraction(Mat frame); Mat getFgMask(){ return _fgmask; } ; cvBlob getBlobMask(){ return _blob; }; private: inline cvBlob initBlob(int id, int x, int y, int w, int h) { cvBlob B = { id,x,y,w,h}; return B; }; int extractBiggestBlog(cv::Mat fgmask, Mat &filled_mask, cvBlob &biggest_blob, int connectivity); Ptr _pMOG2; // Algorithm parameters double _bks_lr; double _var_threshold; int _history; int _connectivity; int _min_width; int _min_height; int _element_size; MorphShapes _erosion_type; Mat _struct_element; Mat _fgmask; // current fg mask cvBlob _blob; // current biggest blob }; #endif /* SRC_OBSERVATIONGENERATOR_HPP_ */