Skip to content

Instantly share code, notes, and snippets.

@hayunjong83
Last active February 14, 2020 10:26
Show Gist options
  • Save hayunjong83/d5ac028309ec7d9ecff65fd1c4fbed0b to your computer and use it in GitHub Desktop.
Save hayunjong83/d5ac028309ec7d9ecff65fd1c4fbed0b to your computer and use it in GitHub Desktop.
Show live webcam by OpenCV c++.
#include <opencv2/opencv.hpp>
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
int main(int argv, char** argc)
{
Mat frame;
VideoCapture cap;
cap.open(0);
if(! cap.isOpendf())
{
cerr << "Unable to open Camera\n";
return -1;
}
while(1)
{
cap.read(frame);
imshow("LIVE", frame);
if(waitkey(1) >=0)
break;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment