从Macbook Pro iSight与Opencv捕获 [英] Capturing from Macbook Pro iSight with Opencv
问题描述
我尝试使用OpenCV 2.4.6从Macbook Pro的iSight捕获帧,并在Xcode上使用Apple LLVM 4.2编译器。
I'm trying to capture frames from a Macbook Pro's iSight using OpenCV 2.4.6, and built using the Apple LLVM 4.2 compiler on Xcode.
但是,我不接收任何帧。通常我设置一个while循环,直到框架已满,但下面的一个运行〜30秒没有结果。如何调试此功能?
However, I don't receive any frames. Usually I set up a while loop to run until the frame is full, but the one below runs for ~30 seconds with no result. How can I debug this?
void testColourCapture() {
cv::VideoCapture capture = cv::VideoCapture(0); //open default camera
if(!capture.isOpened()) {
fprintf( stderr, "ERROR: ColourInput capture is NULL \n" );
}
cv::Mat capFrame;
int frameWaits = 0;
while (capFrame.empty()) {
capture.read(capFrame);
//capture >> capFrame;
cvWaitKey(30);
frameWaits++;
std::cout << "capture >> capFrame " << frameWaits << "\n";
if (frameWaits > 1000) {
break;
}
}
imshow("capFrame", capFrame);
}
我确保它不是多线程的。此外,capture.isOpened总是返回true。
I have ensured it is not multi-threaded. Also, capture.isOpened is always returning true.
编辑:似乎其他人遇到了这个问题: OpenCV不会从MacBook Pro iSight捕获
It appears others have had this problem: OpenCV wont' capture from MacBook Pro iSight
编辑:我的安装程序opencv is:
My procedure for installing opencv was:
$ sudo port selfupdate
$ sudo port selfupdate
$ sudo port install opencv
$ sudo port install opencv
然后,我将libopencv_core.dylib,libopencv_highgui.dylib,libopencv_imgproc.dylib和libopencv_video.dylib拖到我的Xcode项目的Frameworks文件夹中,从/ opt / local / lib
Then, I dragged libopencv_core.dylib, libopencv_highgui.dylib, libopencv_imgproc.dylib and libopencv_video.dylib into the Frameworks folder of my Xcode project, from /opt/local/lib
推荐答案
OpenCV 2.4.6已损坏,不能与iSight相机配合使用。所以安装2.4.5。我为此编写了一个逐步指南: http://accidentalprogramming.blogspot.ch/2013/10/opencv-installation-on-mac-os-x.html
OpenCV 2.4.6 is broken and doesn't work with the iSight camera. So install 2.4.5 instead. I've written a step-for-step guide for this: http://accidentalprogramming.blogspot.ch/2013/10/opencv-installation-on-mac-os-x.html
这篇关于从Macbook Pro iSight与Opencv捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!