2016-05-05 88 views
-1

我有下面的代碼去精在Ubuntu:findContours墜毀在Visual Studio

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)); 

我想它在的Visual Studio 2012的Windows 7,但在行: findContours(threshold_output, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));

它總是與代碼崩潰:

線程0x1bf0已退出,代碼爲-1073740777(0xc0000417)。 線程0x18c8已退出,代碼爲-1073740777(0xc0000417)。 線程0x153c已退出,代碼爲-1073740777(0xc0000417)。 線程0x1990已退出,代碼爲-1073740777(0xc0000417)。 線程0x191c已退出,代碼爲-1073740777(0xc0000417)。 線程0x18d4已退出,代碼爲-1073740777(0xc0000417)。 線程0x197c已退出,代碼爲-1073740777(0xc0000417)。 線程0x1988已退出,代碼爲-1073740777(0xc0000417)。 線程0x1998已退出,代碼爲-1073740777(0xc0000417)。 線程0x1850已退出,代碼爲-1073740777(0xc0000417)。 線程0x19f0已退出,代碼爲-1073740777(0xc0000417)。 線程0x1994已退出,代碼爲-1073740777(0xc0000417)。 線程0x1980已退出,代碼爲-1073740777(0xc0000417)。 線程0x19f8已退出,代碼爲-1073740777(0xc0000417)。 程序'[7148] opencvtest.exe'已退出,代碼爲-1073740777(0xc0000417)。

任何人都可以幫助我如何解決它嗎?謝謝!

+1

在另一臺Windows機器上它是一樣的嗎?這可能是一個驅動程序問題。在這裏閱讀:https://www.quora.com/What-does-0xc0000417-or-1073740777-mean –

+0

是的,這是同一臺機器。謝謝你的答案,我嘗試過。 – xnorbi

回答

0

已解決!我認爲我使用了錯誤版本的opencv。當我切換到2.4.10時,evrything進展良好。