cam.c
上传用户:hfxfswkj
上传日期:2022-03-17
资源大小:17k
文件大小:1k
- #include <cv.h>
- #include <highgui.h>
- #include <cxcore.h>
- #include <sys/types.h>
- #include <stdio.h>
- #include <stdlib.h>
- CvCapture *capture ;
- int init()
- {
- capture =cvCreateCameraCapture(0);
- if (capture)
- {
- cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,320);
- cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,240);
- printf("sucessfuln");
- return 1;
- }
- else
- {
- printf("NOsucessfuln");
- return -1;
- }
- }
- main()
- {
- init();
- IplImage *frame =0;
- char *image32=0;
- char *image;
- cvGrabFrame(capture);
- frame=cvRetrieveFrame( capture );
- image=frame->imageData;
- cvSaveImage("/mnt/c/lwg.jpg",frame);
- cvReleaseCapture(&capture);
- }
-