Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When I run the following code, I get the error

OpenCV Error: Bad Flag <parameter or="" structure="" field=""> <unrecognized or="" unsupported="" array="" type=""> in unknown function, file ......\modules\core\src\array.cpp line 2482

Here's the code:

include "stdafx.h"

include "cv.h"

include "cvaux.h"

include "cxcore.h"

include "highgui.h"

using namespace std;

int main(int argc, char *argv[]) { cv::Mat frame; cv::Mat back; cv::Mat fore; cv::VideoCapture VideoFeed("test.avi"); cv::BackgroundSubtractorMOG bg; bg.nmixtures = 10; bg.history=500;

std::vector<std::vector<cv::Point> > contours;

cv::namedWindow("Frame");
cv::namedWindow("FG");

while (VideoFeed.isOpened()) // Returns true if video capturing has been initialized already. { if(VideoFeed.grab()) // Grabs the next frame from video file or capturing device and return true (non-zero) in the // case of success. { VideoFeed.retrieve(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("BG",back);

    }
    if(cv::waitKey(30) >= 0) break;

} return 0; }

When I run the following code, I get the error

OpenCV Error: Bad Flag <parameter or="" structure="" field=""> <unrecognized or="" unsupported="" array="" type=""> (parameter or structure field) (Unrecognized or unsupported array type) in unknown function, file ......\modules\core\src\array.cpp line 2482

Here's the code:

include "stdafx.h"

include "cv.h"

include "cvaux.h"

include "cxcore.h"

include "highgui.h"

using namespace std;

int main(int argc, char *argv[]) { cv::Mat frame; cv::Mat back; cv::Mat fore; cv::VideoCapture VideoFeed("test.avi"); cv::BackgroundSubtractorMOG bg; bg.nmixtures = 10; bg.history=500;

std::vector<std::vector<cv::Point> > contours;

cv::namedWindow("Frame");
cv::namedWindow("FG");

while (VideoFeed.isOpened()) // Returns true if video capturing has been initialized already. { if(VideoFeed.grab()) // Grabs the next frame from video file or capturing device and return true (non-zero) in the // case of success. { VideoFeed.retrieve(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("BG",back);

    }
    if(cv::waitKey(30) >= 0) break;

} return 0; }

click to hide/show revision 3
No.3 Revision

When I run the following code, I get the error

OpenCV Error: Bad Flag (parameter or structure field) (Unrecognized or unsupported array type) in unknown function, file ......\modules\core\src\array.cpp line 2482

Here's the code:

include "stdafx.h"

include "cv.h"

include "cvaux.h"

include "cxcore.h"

include "highgui.h"

#include "stdafx.h"

#include "cv.h"
#include "cvaux.h"
#include "cxcore.h"
#include "highgui.h"

using namespace std;

std; int main(int argc, char *argv[]) { cv::Mat frame; cv::Mat back; cv::Mat fore; cv::VideoCapture VideoFeed("test.avi"); cv::BackgroundSubtractorMOG bg; bg.nmixtures = 10; bg.history=500;

bg.history=500;


    std::vector<std::vector<cv::Point> > contours;

 cv::namedWindow("Frame");
 cv::namedWindow("FG");

while (VideoFeed.isOpened()) // Returns true if video capturing has been initialized already. { if(VideoFeed.grab()) // Grabs the next frame from video file or capturing device and return true (non-zero) in the // case of success. { VideoFeed.retrieve(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("BG",back);

cv::imshow("BG",back);

        }
     if(cv::waitKey(30) >= 0) break;
   }
    return 0;
}

} return 0; }