你好,游客 登录 注册 搜索
背景:
阅读新闻

OpenCV显示摄像头图像保存成bmp文件 - Augusdi的专栏

[日期:2013-04-06] 来源:  作者: [字体: ]
#include "cv.h" 
#include "highgui.h" 
#include "stdio.h" 
#include "atlstr.h"
#pragma warning(disable : 4996)   
#pragma comment(lib, "cv.lib")
#pragma comment( lib, "cxcore.lib" )   
#pragma comment( lib, "highgui.lib" ) 

int main( int argc, char** argv ) 
{ 
	IplImage* pFrame = NULL; 
	CvCapture* pCapture = NULL; 
	char ImagesName[1024]; 
	int ImgNum=0; 
 	cvNamedWindow("video", 1); 
	pCapture = cvCreateCameraCapture(-1); 
	while(pFrame = cvQueryFrame( pCapture )) 
	{ 
		ImgNum=ImgNum+1; 
		sprintf(ImagesName, "Image%.3d.bmp", ImgNum); 

		cvSaveImage(ImagesName, pFrame); 
 		cvShowImage("video", pFrame); 
		if( cvWaitKey(1) >= 0 ) 
			break; 
	} 
	cvDestroyWindow("video"); 
	cvReleaseCapture(&pCapture); 
	return 0; 





收藏 推荐 打印 | 录入:admin | 阅读:
相关新闻