Hi guys
Can you help me clearly that how I can fix this problem? What is the main reason of this error.
when I run my code, this error appears:

my code is here: (I use Opencv 2.4 and VS 2012)
// ConsoleApplication4_test_findcounter.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "opencv2\core\core.hpp"
#include "opencv2\highgui\highgui.hpp"
#include "opencv2\imgproc\imgproc.hpp"
#include "iostream"
using namespace cv;
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
Mat image;
image = imread("shape.JPG", 1);
namedWindow( "Display window", CV_WINDOW_AUTOSIZE );
imshow( "Display window", image );
Mat gray;
cvtColor(image, gray, CV_BGR2GRAY);
Canny(gray, gray, 100, 200, 3);
/// Find contours
vector> contours;
vector hierarchy;
RNG rng(12345);
findContours( gray, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
/// Draw contours
Mat drawing = Mat::zeros( gray.size(), CV_8UC3 );
for( int i = 0; i< contours.size(); i++ )
{
Scalar color = Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) );
drawContours( drawing, contours, i, color, 2, 8, hierarchy, 0, Point() );
}
imshow( "Result window", drawing );
waitKey(0);
return 0;
}
↧