source: proiecte/PPPP/eigenface2/capture.c @ 108

Last change on this file since 108 was 108, checked in by (none), 14 years ago

new eigenface

File size: 1.0 KB
Line 
1// capture.c - by Robin Hewitt, 2007
2// http://www.cognotics.com/opencv/downloads/camshift_wrapper
3// This is free software. See License.txt, in the download
4// package, for details.
5//
6
7
8#include <stdio.h>
9#include "cv.h"
10#include "highgui.h"
11#include "capture.h"
12
13
14// File-level variables
15CvCapture * pCapture = 0;
16
17//////////////////////////////////
18// initCapture()
19//
20int initCapture()
21{
22        // Initialize video capture
23        pCapture = cvCaptureFromCAM( CV_CAP_ANY );
24        if( !pCapture )
25        {
26                fprintf(stderr, "failed to initialize video capture\n");
27                return 0;
28        }
29
30        return 1;
31}
32
33
34//////////////////////////////////
35// closeCapture()
36//
37void closeCapture()
38{
39        // Terminate video capture and free capture resources
40        cvReleaseCapture( &pCapture );
41        return;
42}
43
44
45//////////////////////////////////
46// nextVideoFrame()
47//
48IplImage * nextVideoFrame()
49{
50        IplImage * pVideoFrame = cvQueryFrame( pCapture );
51        if( !pVideoFrame )
52                fprintf(stderr, "failed to get a video frame\n");
53
54        return pVideoFrame;
55}
56
Note: See TracBrowser for help on using the repository browser.