QTKit не нашел подключенных устройств ввода видео

Следующая ошибка возникает всякий раз, когда я пытаюсь запустить простое приложение для захвата кадров с камеры MacBook Pro 13 «(встроенный iSight):

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 в качестве параметра.

Эта проблема, кажется, происходит с OpenCV v2.4.2 и v2.4.3 в Mac OS X 10.7.5.

Есть идеи?

РЕДАКТИРОВАТЬ:

После небольшого исследования я обнаружил, что QTKit — это набор QuickTime и не имеет ничего общего с Qt. Поэтому следующая логическая вещь, которую нужно сделать, это отключить QTKit из сборки OpenCV, и способ сделать это через флаг -DWITH_QUICKTIME=YES, что заставляет OpenCV собираться с 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

Решение

Просто перезагрузите камеру, решив проблему.
sudo killall VDCAssistant

2

Другие решения

Я сообщил об этой проблеме но теперь я думаю, что это может быть связано с моей системой, я попытаюсь выполнить больше тестов, чтобы очистить его.

Во всяком случае, вот что мне пришлось исправить проблему:

редактировать Модули / 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 и не забудьте снова установить его в вашей системе.

1

По вопросам рекламы [email protected]