田螺便利店—opencv例程之打开摄像头
opencv例程之打开摄像头 #include <iostream>
#include <opencv2/opencv.hpp> using namespace std;
using namespace cv; int main() {
VideoCapture cap(0);
if (!cap.isOpened()) {
return -1;
}
Mat frame;
Mat edges;
bool stoped = false;
while (!stoped) {
cap >> frame;
cvtColor(frame, edges, CV_BGR2GRAY);
imshow("The Video Now!", frame);
if (waitKey(10) >= 0) {
stoped = true;
}
}
return 0;
}
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄
#include <opencv2/opencv.hpp> using namespace std;
using namespace cv; int main() {
VideoCapture cap(0);
if (!cap.isOpened()) {
return -1;
}
Mat frame;
Mat edges;
bool stoped = false;
while (!stoped) {
cap >> frame;
cvtColor(frame, edges, CV_BGR2GRAY);
imshow("The Video Now!", frame);
if (waitKey(10) >= 0) {
stoped = true;
}
}
return 0;
}

更多精彩