c++ - Background subtraction with shadow removal -


i'm working kth dataset contains videos basic human action. i've tried subtract background using opencv-2.4.9 backgroundsubtractormog2, still getting shadows in result.

here code (written in c++) i'm using:

#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/video/background_segm.hpp> //c #include <stdio.h> //c++ #include <iostream> #include <sstream>  using namespace cv; using namespace std;  //global variables mat frame; //current frame mat fgmaskmog2; //fg mask fg mask generated mog2 method ptr<backgroundsubtractor> pmog2; //mog2 background subtractor int keyboard;  //function declarations void processvideo(char* videofilename);  int main(int argc, char* argv[]) {      pmog2 = new backgroundsubtractormog2(); //mog2 approach     pmog2->setint("nmixtures",3);        pmog2->setdouble("ftau",0.5);      processvideo("person14_boxing_d1_uncomp.avi");// read avi file      //destroy gui windows     destroyallwindows();     return exit_success; }  void processvideo(char* videofilename) {     //create capture object     videocapture capture(videofilename);     if(!capture.isopened()){         //error in opening video input         cerr << "unable open video file: " << videofilename << endl;         exit(exit_failure);     }       //read input data. esc or 'q' quitting     while( (char)keyboard != 'q' && (char)keyboard != 27 ){         //read current frame         if(!capture.read(frame)) {             cerr << "unable read next frame." << endl;             cerr << "exiting..." << endl;             //exit(exit_failure);         return;         }         pmog2->operator()(frame, fgmaskmog2, 0.1         imshow("fg mask mog 2", fgmaskmog2);         //get input keyboard         keyboard = waitkey( 30 );     }     //delete capture object     capture.release(); } 

so please me change code can better result.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -