forked from derekmolloy/boneCV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boneCV.cpp
36 lines (34 loc) · 991 Bytes
/
boneCV.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* boneCV.cpp
*
* Copyright Derek Molloy, School of Electronic Engineering, Dublin City University
* www.derekmolloy.ie
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that source code redistributions retain this notice.
*
* This software is provided AS IS and it comes with no warranties of any type.
*/
#include<iostream>
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
VideoCapture capture(0);
capture.set(CV_CAP_PROP_FRAME_WIDTH,1920);
capture.set(CV_CAP_PROP_FRAME_HEIGHT,1080);
if(!capture.isOpened()){
cout << "Failed to connect to the camera." << endl;
}
Mat frame, edges;
capture >> frame;
if(frame.empty()){
cout << "Failed to capture an image" << endl;
return -1;
}
cvtColor(frame, edges, CV_BGR2GRAY);
Canny(edges, edges, 0, 30, 3);
imwrite("edges.png", edges);
imwrite("capture.png", frame);
return 0;
}