田螺便利店—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;
}

猜你喜欢

转载自www.cnblogs.com/mgg520813/p/10851251.html
今日推荐