[英]opencv build failed with xcode
I have a problem with a webcam capturing in opencv. 我在opencv中捕获网络摄像头时遇到问题。
This can be built successfully: 这可以成功构建:
#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
using namespace cv;
int main() {
// VideoCapture cap(0);
// while(true){
// Mat Webcam;
// cap.read(Webcam);
// imshow("Webcam", Webcam);
// }
}
However, this is not: 但是,这不是:
#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
using namespace cv;
int main() {
VideoCapture cap(0);
while(true){
Mat Webcam;
cap.read(Webcam);
imshow("Webcam", Webcam);
}
}
There is no error or warning message popped out, so I can't solve it by myself. 没有弹出错误或警告消息,所以我自己无法解决。
Any idea is appreciated! 任何想法表示赞赏!
Updates: 更新:
It seems something went wrong when I updated xcode..... 当我更新xcode时似乎出了点问题。
Your code is perfectly ok except following line after imshow: 您的代码完全没问题,除了在imshow之后执行以下行:
waitKey(10);
It will provide ui thread to draw the frames. 它将提供ui线程来绘制框架。 Without this delay ui thread can not be updated or get time slice from cpu.
没有此延迟,ui线程将无法更新或无法从cpu获取时间片。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.