2013-01-22 66 views
0

每當我試圖運行的MacBook Pro的13" simple application to grab frames from the camera出現以下錯誤(內置iSight):QTKit沒有發現任何連接的視頻輸入設備

QTKit didn't find any attached Video Input Devices! 
Warning, camera failed to properly initialize! 
Cleaned up camera. 

我已經試過路過 - 1,0和參數cvCreateCameraCapture()cv::VideoCapture對象,但沒有奏效。它說,我用的OpenCV 2.3.1在本機上相當長的一段時間,它工作得很好的傳球-1作爲參數是非常重要的。

這個問題似乎在Mac OS X 10.7.5上使用OpenCV v2.4.2和v2.4.3發生。

任何想法?

編輯:

後的一點點研究,我發現QTKit is the QuickTime Kit並有無關Qt。因此,下一個合乎邏輯的事情是從OpenCV版本中禁用QTKit,並且通過標記-DWITH_QUICKTIME=YES,強制OpenCV使用用於視頻I/O的QuickTime而不是QTKit構建。

不幸的是這種解決方案也不能工作,因爲它引起我不想對付幾個編譯錯誤:

[ 32%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qt.cpp.o 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:75: error: ‘Movie’ does not name a type 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: In function ‘CvCapture_QT_Movie* icvCaptureFromFile_QT(const char*)’: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:100: warning: declaration of ‘did_enter_movies’ shadows a global declaration [-Wshadow] 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:67: warning: shadowed declaration is here [-Wshadow] 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:103: error: ‘EnterMovies’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: In function ‘int icvOpenFile_QT_Movie(CvCapture_QT_Movie*, const char*)’: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:142: error: ‘ClearMoviesStickyError’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:145: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:161: error: ‘kQTPOSIXPathStyle’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:161: error: ‘QTNewDataReferenceFromFullPathCFString’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:169: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:169: error: ‘newMovieActive’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:169: error: ‘newMovieAsyncOK’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:170: error: ‘NewMovieFromDataRef’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:190: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:190: error: ‘nextTimeMediaSample’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:190: error: ‘nextTimeEdgeOK’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:191: error: ‘GetMovieNextInterestingTime’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:205: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:212: error: ‘GetMoviesError’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:213: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:213: error: ‘GetMovieBox’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:218: error: ‘QTNewGWorld’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:220: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:220: error: ‘SetMovieGWorld’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: In function ‘int icvClose_QT_Movie(CvCapture_QT_Movie*)’: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:243: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:247: error: ‘DisposeGWorld’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:248: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:248: error: ‘DisposeMovie’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: In function ‘double icvGetProperty_QT_Movie(CvCapture_QT_Movie*, int)’: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:264: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:281: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:281: error: ‘GetMovieTimeScale’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:286: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:286: error: ‘GetMovieDuration’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:300: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:300: error: ‘GetMovieDuration’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:301: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:301: error: ‘GetMovieTimeScale’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: In function ‘int icvSetProperty_QT_Movie(CvCapture_QT_Movie*, int, double)’: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:331: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:351: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:351: error: ‘GetMovieTimeScale’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:356: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:356: error: ‘GetMovieDuration’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:370: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:370: error: ‘nextTimeStep’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:371: error: ‘GetMovieNextInterestingTime’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:372: error: ‘GetMoviesError’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:385: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:385: error: ‘nextTimeStep’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:386: error: ‘GetMovieNextInterestingTime’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:387: error: ‘GetMoviesError’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:408: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:408: error: ‘nextTimeStep’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:409: error: ‘GetMovieNextInterestingTime’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:410: error: ‘GetMoviesError’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: In function ‘int icvGrabFrame_QT_Movie(CvCapture_QT_Movie*)’: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:441: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:449: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:449: error: ‘SetMovieTimeValue’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:450: error: ‘GetMoviesError’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:458: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:458: error: ‘GetMovieTime’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:462: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:462: error: ‘nextTimeStep’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:462: error: ‘GetMovieNextInterestingTime’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: In function ‘const void* icvRetrieveFrame_QT_Movie(CvCapture_QT_Movie*, int)’: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:484: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:494: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:494: error: ‘UpdateMovie’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:495: error: ‘GetMoviesError’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:503: error: ‘struct CvCapture_QT_Movie’ has no member named ‘myMovie’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:503: error: ‘MoviesTask’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:515: error: ‘GetGWorldPixMap’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:516: error: ‘LockPixels’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:517: error: ‘GetPixBaseAddr’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:517: error: ‘GetPixRowBytes’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:523: error: ‘UnlockPixels’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: At global scope: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:556: error: ‘SeqGrabComponent’ does not name a type 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:557: error: ‘SGChannel’ does not name a type 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:560: error: ‘ImageSequence’ does not name a type 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: In function ‘CvCapture_QT_Cam* icvCaptureFromCam_QT(int)’: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:590: error: ‘EnterMovies’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp: At global scope: 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:609: warning: unused parameter ‘capture’ [-Wunused-parameter] 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:609: warning: unused parameter ‘property_id’ [-Wunused-parameter] 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:616: warning: unused parameter ‘capture’ [-Wunused-parameter] 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:616: warning: unused parameter ‘property_id’ [-Wunused-parameter] 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:616: warning: unused parameter ‘value’ [-Wunused-parameter] 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: error: ‘SGChannel’ was not declared in this scope 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: error: expected primary-expression before ‘raw_data’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: error: expected primary-expression before ‘long’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: error: expected primary-expression before ‘long’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: error: expected primary-expression before ‘long’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: error: expected primary-expression before ‘,’ token 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: error: expected primary-expression before ‘short’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: error: expected primary-expression before ‘long’ 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: error: initializer expression list treated as compound expression 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:854: error: expected ‘,’ or ‘;’ before ‘{’ token 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:238: warning: ‘int icvClose_QT_Movie(CvCapture_QT_Movie*)’ defined but not used 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:261: warning: ‘double icvGetProperty_QT_Movie(CvCapture_QT_Movie*, int)’ defined but not used 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:328: warning: ‘int icvSetProperty_QT_Movie(CvCapture_QT_Movie*, int, double)’ defined but not used 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:438: warning: ‘int icvGrabFrame_QT_Movie(CvCapture_QT_Movie*)’ defined but not used 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:481: warning: ‘const void* icvRetrieveFrame_QT_Movie(CvCapture_QT_Movie*, int)’ defined but not used 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:98: warning: ‘CvCapture_QT_Movie* icvCaptureFromFile_QT(const char*)’ defined but not used 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:572: warning: ‘int icvOpenCamera_QT(CvCapture_QT_Cam*, int)’ declared ‘static’ but never defined 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:573: warning: ‘int icvClose_QT_Cam(CvCapture_QT_Cam*)’ declared ‘static’ but never defined 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:609: warning: ‘double icvGetProperty_QT_Cam(CvCapture_QT_Cam*, int)’ defined but not used 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:616: warning: ‘int icvSetProperty_QT_Cam(CvCapture_QT_Cam*, int, double)’ defined but not used 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:576: warning: ‘int icvGrabFrame_QT_Cam(CvCapture_QT_Cam*)’ declared ‘static’ but never defined 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:577: warning: ‘const void* icvRetrieveFrame_QT_Cam(CvCapture_QT_Cam*, int)’ declared ‘static’ but never defined 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:586: warning: ‘CvCapture_QT_Cam* icvCaptureFromCam_QT(int)’ defined but not used 
/OpenCV-2.4.3/modules/highgui/src/cap_qt.cpp:853: warning: ‘icvDataProc_QT_Cam’ defined but not used 
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qt.cpp.o] Error 1 
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 
make: *** [all] Error 2 
+0

嘗試構建沒有QT的OpenCV並檢查。 – ArtemStorozhuk

+0

我試過了,但沒有爲我工作。我還強制OpenCV使用QUICKTIME而不是libdc1394,然後編譯有關'* DisposeGWorld *'未在此範圍內聲明的錯誤(這表示OpenCV使用的是已棄用的Mac API)。 – karlphillip

+0

你的意思是不適合我嗎?錯誤嗎?如果是,那麼你可以發佈它嗎? – ArtemStorozhuk

回答

1

I reported this problem,但現在我認爲這可能是具體到我的系統,我我會嘗試進行更多的測試來清除它。

總之,這裏的我有什麼,來解決該問題:

編輯模塊/ highgui/src目錄/ cap_qtkit.mm並跳轉到行313看到的實施:

int CvCaptureCAM::startCaptureDevice(int cameraNum) { 

我們的變化將作出此方法,以便找到以下塊:

if (cameraNum >= 0) { 
    int nCameras = [devices count]; 
    if(cameraNum < 0 || cameraNum >= nCameras) 
     return 0; 
    device = [devices objectAtIndex:cameraNum] ; 
} else { 
    device = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo] ; 
} 

更換它由:

if (cameraNum >= 0) { 
    int nCameras = [devices count]; 
    if(cameraNum > nCameras) 
     return 0; 
    cameraNum--; 
    device = [devices objectAtIndex:cameraNum] ; 
} else { 
    device = [QTCaptureDevice defaultInputDeviceWithMediaType:QTMediaTypeVideo] ; 
} 

重新編譯OpenCV的,不要忘了在系統上重新安裝。

2

只需重新啓動相機即可解決問題。 sudo killall VDCAssistant

相關問題