想使用C++ 和opencv打开摄像头并对一个特定小铁球进行识别并输出对象坐标,请问该如何实现?
void Video() {
VideoCapture capture(1);
if (!capture.isOpened()) { //test cam
cout << "cam open error" << endl;
}
while (true) { // cycle frame
Mat frame;
capture >> frame;
imshow("cam", frame);
waitKey(30); //延时30
}
}
int main(int argc, char *argv[]) {
thread th = thread(Video);
th.detach();
return 0;
}