Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

findContours - Critical error detected c0000374

Hi guys, I just began learning how to use OpenCV library. I'm using VS2013(update 3) + OpenCV 3.0 Beta.

I'm encountering some error when trying to use findContours(). I get some unhandled exceptions in opencv_world300.dl. I've searched the web for findContours() related errors and I know that it should get a single channel B&W image, so that's what I do:

include "stdafx.h"

include "opencv2/core/core.hpp"

include "opencv2/flann/miniflann.hpp"

include "opencv2/imgproc/imgproc.hpp"

include "opencv2/photo/photo.hpp"

include "opencv2/video/video.hpp"

include "opencv2/features2d/features2d.hpp"

include "opencv2/objdetect/objdetect.hpp"

include "opencv2/calib3d/calib3d.hpp"

include "opencv2/ml/ml.hpp"

include "opencv2/highgui/highgui.hpp"

include "opencv2/core/core_c.h"

include "opencv2/highgui/highgui_c.h"

include "opencv2/imgproc/imgproc_c.h"

include <iostream>

include <vector>

using namespace cv; using namespace std;

int _tmain(int argc, _TCHAR* argv[]) { cv::Mat frame, frame_gray, threshImg; cv::Mat back; cv::Mat fore; cv::VideoCapture cap; cap.open(1); if (!cap.isOpened()) { std::cerr << "ERROR: Could not access the camera!" << std::endl; }

Ptr<BackgroundSubtractorMOG2> bg = createBackgroundSubtractorMOG2(500, 16, false);


vector<vector<Point> > contours;
vector<Vec4i> hierarchy;

cv::namedWindow("Frame");
cv::namedWindow("Foreground");
cv::namedWindow("Background");

for (;;)
{
    cap >> frame;

    bg->apply(frame, fore);
    bg->getBackgroundImage(back);
    cv::erode(fore, fore, cv::Mat());
    cv::dilate(fore, fore, cv::Mat());

    cvtColor(fore, threshImg, CV_BGR2GRAY);
    findContours(threshImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);

    cv::imshow("Frame", frame);
    cv::imshow("Background", back);
    cv::imshow("Foreground", fore);

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

return 0;

}

Any clue what I'm doing wrong? :)

Thanks!

findContours - Critical error detected c0000374unhandled exception

Hi guys, I just began learning how to use OpenCV library. I'm using VS2013(update 3) + OpenCV 3.0 Beta.

I'm encountering some error when trying to use findContours(). I get some unhandled exceptions in opencv_world300.dl. I've searched the web for findContours() related errors and I know that it should get a single channel B&W image, so that's what I do:

include "stdafx.h"

include "opencv2/core/core.hpp"

include "opencv2/flann/miniflann.hpp"

include "opencv2/imgproc/imgproc.hpp"

include "opencv2/photo/photo.hpp"

include "opencv2/video/video.hpp"

include "opencv2/features2d/features2d.hpp"

include "opencv2/objdetect/objdetect.hpp"

include "opencv2/calib3d/calib3d.hpp"

include "opencv2/ml/ml.hpp"

include "opencv2/highgui/highgui.hpp"

include "opencv2/core/core_c.h"

include "opencv2/highgui/highgui_c.h"

include "opencv2/imgproc/imgproc_c.h"

include <iostream>

include <vector>

using namespace cv; using namespace std;

int _tmain(int argc, _TCHAR* argv[]) { cv::Mat frame, frame_gray, threshImg; cv::Mat back; cv::Mat fore; cv::VideoCapture cap; cap.open(1); if (!cap.isOpened()) { std::cerr << "ERROR: Could not access the camera!" << std::endl; }

Ptr<BackgroundSubtractorMOG2> bg = createBackgroundSubtractorMOG2(500, 16, false);


vector<vector<Point> > contours;
vector<Vec4i> hierarchy;

cv::namedWindow("Frame");
cv::namedWindow("Foreground");
cv::namedWindow("Background");

for (;;)
{
    cap >> frame;

    bg->apply(frame, fore);
    bg->getBackgroundImage(back);
    cv::erode(fore, fore, cv::Mat());
    cv::dilate(fore, fore, cv::Mat());

    cvtColor(fore, threshImg, CV_BGR2GRAY);
    findContours(threshImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);

    cv::imshow("Frame", frame);
    cv::imshow("Background", back);
    cv::imshow("Foreground", fore);

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

return 0;

}

Any clue what I'm doing wrong? :)

Thanks!

findContours - unhandled exception

Hi guys, I I've just began learning how to use OpenCV library. I'm using VS2013(update 3) + OpenCV 3.0 Beta.

I'm encountering some error when trying to use findContours(). I get some unhandled exceptions in opencv_world300.dl. opencv_world300.dll. I've searched the web for findContours() related errors and I know that it should get a single channel B&W image, so that's what I do:

include "stdafx.h"

include "opencv2/core/core.hpp"

include "opencv2/flann/miniflann.hpp"

include "opencv2/imgproc/imgproc.hpp"

include "opencv2/photo/photo.hpp"

include "opencv2/video/video.hpp"

include "opencv2/features2d/features2d.hpp"

include "opencv2/objdetect/objdetect.hpp"

include "opencv2/calib3d/calib3d.hpp"

include "opencv2/ml/ml.hpp"

include "opencv2/highgui/highgui.hpp"

include "opencv2/core/core_c.h"

include "opencv2/highgui/highgui_c.h"

include "opencv2/imgproc/imgproc_c.h"

include <iostream>

include <vector>

using namespace cv; using namespace std;

int _tmain(int argc, _TCHAR* argv[]) { cv::Mat frame, frame_gray, threshImg; cv::Mat back; cv::Mat fore; cv::VideoCapture cap; cap.open(1); if (!cap.isOpened()) { std::cerr << "ERROR: Could not access the camera!" << std::endl; }

Ptr<BackgroundSubtractorMOG2> bg = createBackgroundSubtractorMOG2(500, 16, false);


vector<vector<Point> > contours;
vector<Vec4i> hierarchy;

cv::namedWindow("Frame");
cv::namedWindow("Foreground");
cv::namedWindow("Background");

for (;;)
{
    cap >> frame;

    bg->apply(frame, fore);
    bg->getBackgroundImage(back);
    cv::erode(fore, fore, cv::Mat());
    cv::dilate(fore, fore, cv::Mat());

    cvtColor(fore, threshImg, CV_BGR2GRAY);
    findContours(threshImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);

    cv::imshow("Frame", frame);
    cv::imshow("Background", back);
    cv::imshow("Foreground", fore);

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

return 0;

}

Any clue what I'm doing wrong? :)

Thanks!

findContours - unhandled exception

Hi guys, I've just began learning how to use OpenCV library. I'm using VS2013(update 3) + OpenCV 3.0 Beta.

I'm encountering some error when trying to use findContours(). I get some unhandled exceptions in opencv_world300.dll. I've searched the web for findContours() related errors and I know that it should get a single channel B&W image, so that's what I do:

include "stdafx.h"

include "opencv2/core/core.hpp"

include "opencv2/flann/miniflann.hpp"

include "opencv2/imgproc/imgproc.hpp"

include "opencv2/photo/photo.hpp"

include "opencv2/video/video.hpp"

include "opencv2/features2d/features2d.hpp"

include "opencv2/objdetect/objdetect.hpp"

include "opencv2/calib3d/calib3d.hpp"

include "opencv2/ml/ml.hpp"

include "opencv2/highgui/highgui.hpp"

include "opencv2/core/core_c.h"

include "opencv2/highgui/highgui_c.h"

include "opencv2/imgproc/imgproc_c.h"

include <iostream>

include <vector>

using namespace cv; using namespace std;

int _tmain(int argc, _TCHAR* argv[]) { cv::Mat frame, frame_gray, threshImg; cv::Mat back; cv::Mat fore; cv::VideoCapture cap; cap.open(1); cap.open(1);

if (!cap.isOpened())
 {
     std::cerr << "ERROR: Could not access the camera!" << std::endl;
    }

}

Ptr<BackgroundSubtractorMOG2> bg = createBackgroundSubtractorMOG2(500, 16, false);


vector<vector<Point> > contours;
vector<Vec4i> hierarchy;

cv::namedWindow("Frame");
cv::namedWindow("Foreground");
cv::namedWindow("Background");

for (;;)
{
    cap >> frame;

    bg->apply(frame, fore);
    bg->getBackgroundImage(back);
    cv::erode(fore, fore, cv::Mat());
    cv::dilate(fore, fore, cv::Mat());

    cvtColor(fore, threshImg, CV_BGR2GRAY);
    findContours(threshImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);

    cv::imshow("Frame", frame);
    cv::imshow("Background", back);
    cv::imshow("Foreground", fore);

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

return 0;

}

Any clue what I'm doing wrong? :)

Thanks!

findContours - unhandled exception

Hi guys, I've just began learning how to use OpenCV library. I'm using VS2013(update 3) + OpenCV 3.0 Beta.

I'm encountering some error when trying to use findContours(). I get some unhandled exceptions in opencv_world300.dll. I've searched the web for findContours() related errors and I know that it should get a single channel B&W image, so that's what I do:

int _tmain(int argc, _TCHAR* argv[]) { cv::Mat frame, frame_gray, threshImg; cv::Mat back; cv::Mat fore; cv::VideoCapture cap; cap.open(1);

if (!cap.isOpened())
{
    std::cerr << "ERROR: Could not access the camera!" << std::endl;
}

Ptr<BackgroundSubtractorMOG2> bg = createBackgroundSubtractorMOG2(500, 16, false);


vector<vector<Point> > contours;
vector<Vec4i> hierarchy;

cv::namedWindow("Frame");
cv::namedWindow("Foreground");
cv::namedWindow("Background");

for (;;)
{
    cap >> frame;

    bg->apply(frame, fore);
    bg->getBackgroundImage(back);
    cv::erode(fore, fore, cv::Mat());
    cv::dilate(fore, fore, cv::Mat());

    cvtColor(fore, threshImg, CV_BGR2GRAY);
    findContours(threshImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);

    cv::imshow("Frame", frame);
    cv::imshow("Background", back);
    cv::imshow("Foreground", fore);

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

return 0;

}

Any clue what I'm doing wrong? :)

Thanks!

UPDATE: Also I tried the code found at: http://stackoverflow.com/questions/8449378/finding-contours-in-opencv

int countours(Mat _image) { cv::Mat image = _image; if (!image.data) { std::cout << "Image file not found\n"; return 1; }

//Prepare the image for findContours
cv::cvtColor(image, image, CV_BGR2GRAY);
cv::threshold(image, image, 128, 255, CV_THRESH_BINARY);

//Find the contours. Use the contourOutput Mat so the original image doesn't get overwritten
std::vector<std::vector<cv::Point> > contours;
cv::Mat contourOutput = image.clone();
cv::findContours(contourOutput, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);

//Draw the contours
cv::Mat contourImage(image.size(), CV_8UC3, cv::Scalar(0, 0, 0));
cv::Scalar colors[3];
colors[0] = cv::Scalar(255, 0, 0);
colors[1] = cv::Scalar(0, 255, 0);
colors[2] = cv::Scalar(0, 0, 255);
for (size_t idx = 0; idx < contours.size(); idx++) {
    cv::drawContours(contourImage, contours, idx, colors[idx % 3]);
}

cv::imshow("Input Image", image);
cvMoveWindow("Input Image", 0, 0);
cv::imshow("Contours", contourImage);
cvMoveWindow("Contours", 200, 0);
cv::waitKey(0);

return 0;

}

and I'm also hitting a break point with a 'Critical error detected c0000374' message in debug output.

findContours - unhandled exception

Hi guys, I've just began learning how to use OpenCV library. I'm using VS2013(update 3) + OpenCV 3.0 Beta.

I'm encountering some error when trying to use findContours(). I get some unhandled exceptions in opencv_world300.dll. I've searched the web for findContours() related errors and I know that it should get a single channel B&W image, so that's what I do:

int _tmain(int argc, _TCHAR* argv[]) { cv::Mat frame, frame_gray, threshImg; cv::Mat back; cv::Mat fore; cv::VideoCapture cap; cap.open(1);

if (!cap.isOpened())
{
    std::cerr << "ERROR: Could not access the camera!" << std::endl;
}

Ptr<BackgroundSubtractorMOG2> bg = createBackgroundSubtractorMOG2(500, 16, false);


vector<vector<Point> > contours;
vector<Vec4i> hierarchy;

cv::namedWindow("Frame");
cv::namedWindow("Foreground");
cv::namedWindow("Background");

for (;;)
{
    cap >> frame;

    bg->apply(frame, fore);
    bg->getBackgroundImage(back);
    cv::erode(fore, fore, cv::Mat());
    cv::dilate(fore, fore, cv::Mat());

    cvtColor(fore, threshImg, CV_BGR2GRAY);
    findContours(threshImg, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);

    cv::imshow("Frame", frame);
    cv::imshow("Background", back);
    cv::imshow("Foreground", fore);

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

return 0;

}

Any clue what I'm doing wrong? :)

Thanks!

UPDATE: Also I tried the code found at: http://stackoverflow.com/questions/8449378/finding-contours-in-opencv

int countours(Mat _image) { cv::Mat image = _image; if (!image.data) { std::cout << "Image file not found\n"; return 1; }

//Prepare the image for findContours
cv::cvtColor(image, image, CV_BGR2GRAY);
cv::threshold(image, image, 128, 255, CV_THRESH_BINARY);

//Find the contours. Use the contourOutput Mat so the original image doesn't get overwritten
std::vector<std::vector<cv::Point> > contours;
cv::Mat contourOutput = image.clone();
cv::findContours(contourOutput, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);

//Draw the contours
cv::Mat contourImage(image.size(), CV_8UC3, cv::Scalar(0, 0, 0));
cv::Scalar colors[3];
colors[0] = cv::Scalar(255, 0, 0);
colors[1] = cv::Scalar(0, 255, 0);
colors[2] = cv::Scalar(0, 0, 255);
for (size_t idx = 0; idx < contours.size(); idx++) {
    cv::drawContours(contourImage, contours, idx, colors[idx % 3]);
}

cv::imshow("Input Image", image);
cvMoveWindow("Input Image", 0, 0);
cv::imshow("Contours", contourImage);
cvMoveWindow("Contours", 200, 0);
cv::waitKey(0);

return 0;

}

and I'm also hitting a break point with a 'Critical error detected c0000374' message in debug output.

UPDATE 2: Looks like it's a bug in opencv_world300.dll - I renamed opencv_world300d.dll to opencv_world300.dll and placed it binary directory and it works now. It must be some bug in release version of library, maybe some compiler optimization doesn't work properly.