Backgroundsubtractormog problem of mixed Gaussian algorithm for OpenCV 2.4.7

Source: Internet
Author: User

The video processing is for the foreground extraction, the mixed Gaussian algorithm is called in the CV space domain name but in opencv2.4.7 the direct call error occurs:

Backgroundsubtractormog This member is not indicated in CV;

I looked it up on the Internet. The analysis says: 2.4.7 cannot detect an example in the home page when it is used. In the only I added the header file, found just add:

#include <cvaux.h> can call Backgroundsubtractormog this member;

Attached code:

1#include <cv.h>2#include 3#include <cvaux.h>4 5 intMain ()6 {7     //open a video file8Cv::videocapture Capture ("D:\\1\\1.mp4");9     //Check if the video is open successfullyTen     if(!capture.isopened ()) One         return 0; A     //Current Video Frame - Cv::mat frame; -     //Foreground Image the Cv::mat foreground; -Cv::namedwindow ("extracted F"); -     //mixture of Gaussian object with default parameters - Cv::backgroundsubtractormog Mog; +     BOOLStopfalse); -     //iterate through each frame +      while(!stop) { A         //Read Next Frame at         if(!Capture.read (frame)) -              Break; -         //update the background and return to the foreground -Mog (Frame,foreground,0.01); -         //Reverse the image -Cv::threshold (foreground, foreground, -,255, CV::THRESH_BINARY_INV); in         //Show Foreground -Cv::imshow ("extracted F", foreground); to         //introduce delay; month can end video by pressing ESC +         if(Cv::waitkey (Ten) >=0) -Stop =true; the     } *}

Summary: Or the commonly used header files are written, so as not to appear this unnecessary error!!

    1. #include <cv.h>
    2. #include <cxcore.h>
    3. #include
    4. #include <cvaux.h>
    5. #include <iostream>
    6. #include <string>

Backgroundsubtractormog problem of mixed Gaussian algorithm for OpenCV 2.4.7

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.