Note that there are some explanatory texts on larger screens.

plurals
  1. POError in BackgroundSubtraction Mog2
    text
    copied!<p>I am using opencv 2.4.4 and when i run this algorithm on it , it give me the error on <code>nmixtures</code> and <code>bShadowDetection</code></p> <pre><code>#include &lt;iostream&gt; #include &lt;sys/stat.h&gt; #include &lt;stdio.h&gt; #include &lt;conio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;opencv/cv.h&gt; #include "opencv2/features2d/features2d.hpp" #include &lt;opencv/highgui.h&gt; #include "opencv2/opencv.hpp" #include "opencv2/core/core.hpp" #include "opencv2/nonfree/features2d.hpp" #include "opencv2/highgui/highgui.hpp" #include "opencv2/calib3d/calib3d.hpp" #include &lt;vector&gt; #pragma comment (lib , "opencv_core244d.lib") #pragma comment (lib ,"opencv_highgui244d.lib") #pragma comment(lib , "opencv_imgproc244d.lib") #pragma comment(lib ,"opencv_video244.lib") using namespace cv; int main(int argc, char *argv[]) { cv::Mat frame; cv::Mat back; cv::Mat fore; cv::VideoCapture cap("try2.avi"); cap &gt;&gt; frame; cv::initModule_video(); cv::BackgroundSubtractorMOG2 bg(100, 16, true); // history is an int, distance_threshold is an int (usually set to 16), shadow_detection is a bool bg.set("nmixtures", 3); bg(frame, fore, -1); //learning_rate = -1 here std::vector&lt;std::vector&lt;cv::Point&gt; &gt; contours; cv::namedWindow("Frame"); cv::namedWindow("Background"); for(;;) { cap &gt;&gt; frame; bg.operator ()(frame,fore); bg.getBackgroundImage(back); cv::erode(fore,fore,cv::Mat()); cv::dilate(fore,fore,cv::Mat()); cv::findContours(fore,contours,CV_RETR_EXTERNAL,CV_CHAIN_APPROX_NONE); cv::drawContours(frame,contours,-1,cv::Scalar(0,0,255),2); cv::imshow("Frame",frame); cv::imshow("Background",back); if(cv::waitKey(30) &gt;= 0) break; } return 0; } </code></pre> <p>Error's</p> <pre><code>error C2248: 'cv::BackgroundSubtractorMOG2::nmixtures' : cannot access protected member declared in class 'cv::BackgroundSubtractorMOG2' error C2248: 'cv::BackgroundSubtractorMOG2::bShadowDetection' : cannot access protected member declared in class 'cv::BackgroundSubtractorMOG2' </code></pre> <p>When i use it like below , it didn't give syntax error , but give me error at runtime</p> <pre><code>bg.set("nmixtures", 3); bg.set("detectShadows", false); </code></pre> <p>Error</p> <pre><code>Unhandled exception at 0x7617812f in WK01.exe: Microsoft C++ exception: cv::Exception at memory location 0x001de2d0.. opencv error : Bad argument (no parameter nmixture is found) in unknown function </code></pre> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload