📄 capture.c
字号:
// capture.c - by Robin Hewitt, 2007
// http://www.cognotics.com/opencv/downloads/camshift_wrapper
// This is free software. See License.txt, in the download
// package, for details.
//
#include <stdio.h>
#include "cv.h"
#include "highgui.h"
#include "capture.h"
// File-level variables
CvCapture * pCapture = 0;
//////////////////////////////////
// initCapture()
//
int initCapture()
{
// Initialize video capture
pCapture = cvCaptureFromCAM( CV_CAP_ANY );
if( !pCapture )
{
fprintf(stderr, "failed to initialize video capture\n");
return 0;
}
return 1;
}
//////////////////////////////////
// closeCapture()
//
void closeCapture()
{
// Terminate video capture and free capture resources
cvReleaseCapture( &pCapture );
return;
}
//////////////////////////////////
// nextVideoFrame()
//
IplImage * nextVideoFrame()
{
IplImage * pVideoFrame = cvQueryFrame( pCapture );
if( !pVideoFrame )
fprintf(stderr, "failed to get a video frame\n");
return pVideoFrame;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -