-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjust_to_check_camera.cpp
More file actions
46 lines (37 loc) · 1.06 KB
/
just_to_check_camera.cpp
File metadata and controls
46 lines (37 loc) · 1.06 KB
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
37
38
39
40
41
42
43
44
45
46
//#include <opencv2/objdetect/objdetect.hpp>
//#include <opencv2/highgui/highgui.hpp>
//#include <opencv2/imgproc/imgproc.hpp>
#include<opencv2/opencv.hpp>
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
int main( int argc, const char** argv )
{
CvCapture* capture = 0;
Mat frame, frameCopy, image;
capture = cvCaptureFromCAM( 0 ); //0=default, -1=any camera, 1..99=your camera
if(!capture) cout << "No camera detected" << endl;
cout << capture;
cvNamedWindow( "result", 1 );
if( capture )
{
cout << "In capture ..." << endl;
for(;;)
{
IplImage* iplImg = cvQueryFrame( capture );
frame = iplImg;
if( frame.empty() )
break;
if( iplImg->origin == IPL_ORIGIN_TL )
frame.copyTo( frameCopy );
else
flip( frame, frameCopy, 0 );
if( waitKey( 10 ) >= 0 )
cvReleaseCapture( &capture );
}
waitKey(0);
cvDestroyWindow("result");
return 0;
}
}