Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Compile with opencv 2.1 April 2010 Release
- Assuming you have the libraries installed centrally, e.g. prefix /usr thus /usr/include and /usr/lib
- you can compile with:
- gcc -g -std=c99 -lopencv_highgui -lopencv_core -lopencv_imgproc -lopencv_features2d main.c -o CamTest
- I recommend -g so you can use gdb with something like gdb ./CamTest and then inside gdb:
- b 7
- run
- */
- #include <stdio.h>
- #include <opencv/cv.h>
- #include <opencv/highgui.h>
- int main(int argc, char **argv)
- {
- IplImage *l_ipiCapture;
- CvCapture *l_cvcCamera;
- l_cvcCamera = cvCreateCameraCapture(CV_CAP_ANY);
- if(!l_cvcCamera)
- {
- printf("Unable to capture camera.");
- exit(1);
- }
- while(1)
- {
- cvNamedWindow("Cam Test",CV_WINDOW_AUTOSIZE);
- l_ipiCapture = cvQueryFrame(l_cvcCamera);
- cvShowImage("Cam Test",l_ipiCapture);
- if( (cvWaitKey(10) & 255) == 27 ) break;
- }
- cvReleaseImage(&l_ipiCapture);
- cvReleaseCapture(&l_cvcCamera);
- cvDestroyWindow("Cam Test");
- exit(0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement