Tuesday, November 8, 2011

Opencv extract background from video

opencv 2.3.1

#include <iostream>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv2/video/background_segm.hpp>

using namespace std;
using namespace cv;

int main(int argc, char** argv) {
     VideoCapture capture(argv[1]);
     if(!capture.isOpened())
          return -1;
     Mat frame, foreground;
     BackgroundSubtractorMOG mog;
     while(1){
          if(!capture.read(frame))
               break;
          mog(frame, foreground, 0.05);
          threshold(foreground,           foreground,120,255,THRESH_BINARY_INV);
          imshow("img", frame);
          imshow(argv[1], foreground);
          if(waitKey(10)> 0) break;
     }
}

Centos 7 reset root/ any user lost password / lockout due to cant remember password

1. Need to be in front of the terminal. (Physically if not vm). 2. Reboot the server 3. Press 'e' in the GRUB2 boot screen. 3. bunch...