findContours crash in Visual studio

-1

I have the following code going fine in ubuntu:

    img = imread("E:/object_recognition_c++/build/saved images/webcam_capture_2.jpg", CV_LOAD_IMAGE_COLOR);   // Read the file, comment if use camera
    Mat img_orginal = img;
    Mat src_gray, threshold_output;
    vector<vector<Point> > contours;

    cvtColor(img, src_gray, CV_BGR2GRAY);
    blur(src_gray, src_gray, Size(3, 3));
    int thresh = 85;
    threshold(src_gray, threshold_output, thresh, 255, THRESH_BINARY);  /// Detect edges using Threshold
    imshow("threshold_output", threshold_output);
    vector<Vec4i> hierarchy;
    findContours(threshold_output, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));

I tried it in windows 7 on Visual Studio 2012 but at line: findContours(threshold_output, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));

It always crash with code:

The thread 0x1bf0 has exited with code -1073740777 (0xc0000417). The thread 0x18c8 has exited with code -1073740777 (0xc0000417). The thread 0x153c has exited with code -1073740777 (0xc0000417). The thread 0x1990 has exited with code -1073740777 (0xc0000417). The thread 0x191c has exited with code -1073740777 (0xc0000417). The thread 0x18d4 has exited with code -1073740777 (0xc0000417). The thread 0x197c has exited with code -1073740777 (0xc0000417). The thread 0x1988 has exited with code -1073740777 (0xc0000417). The thread 0x1998 has exited with code -1073740777 (0xc0000417). The thread 0x1850 has exited with code -1073740777 (0xc0000417). The thread 0x19f0 has exited with code -1073740777 (0xc0000417). The thread 0x1994 has exited with code -1073740777 (0xc0000417). The thread 0x1980 has exited with code -1073740777 (0xc0000417). The thread 0x19f8 has exited with code -1073740777 (0xc0000417). The program '[7148] opencvtest.exe' has exited with code -1073740777 (0xc0000417).

Can anybody help me how I can solve it? Thank You!

c++
opencv
visual-studio-2012
asked on Stack Overflow May 5, 2016 by NNN123

1 Answer

0

SOLVED! I think I was used wrong version of opencv. When I switched to 2.4.10 evrything is going fine.

answered on Stack Overflow May 5, 2016 by NNN123

User contributions licensed under CC BY-SA 3.0