int main()
{
CvCapture *capture;
IplImage *frame;
char AviFileName[]="G:\\movie.mkv";
capture = cvCaptureFromAVI(AviFileName);
//cvNamedWindow("AVI player",0);
char name[100];
int cnt =0 ;
while(true)
{
if(cvGrabFrame(capture))
{
frame=cvRetrieveFrame(capture);
//cvShowImage("AVI player",frame);
sprintf(name,"G:/outputFile/%d.jpg",cnt);
if((cnt%200) == 0)
SaveImg(name,frame);
memset(name,0,100);
if(cvWaitKey(10)>=0)
break;
cnt++;
}
else
{
break;
}
}
cvReleaseCapture(&capture);
cvDestroyWindow("AVI player");
}
void printSub(int data[],int heigth, int width){
for(int i = 0 ;i < heigth ;i++){
for(int j = 0 ;j < width ;j++){
printf("%d ",data[(i*width)+j]);
}
printf("\n");
}
printf("\n");
}
void SaveImg(char filename[],IplImage* img){
// Write the image to a file with a different name
if( !cvSaveImage(filename, img) )
{
fprintf(stderr, "failed to write image file\n");
}
}
int openMyFile1(char *filename,double outData_norm[]) {
FILE *file = fopen(filename, "w");
if(!file) {
puts("cant read");
return 1;
}
//printf("%d\n",sizeof(outData)/sizeof(int));
for(int i = 0 ; i < 10;i++){
fprintf(file,"%f ",outData_norm[i]);
}
fclose(file);
return 0;
}
int openMyFile(char *filename,double outData_norm[]) {
FILE *file = fopen(filename, "w");
if(!file) {
puts("cant read");
return 1;
}
//printf("%d\n",sizeof(outData)/sizeof(int));
for(int i = 0 ; i < 512;i++){
for(int j = 0 ; j < 512;j++){
fprintf(file,"%f ",outData_norm[i*512+j]);
}
fprintf(file,"\n");
}
fclose(file);
return 0;
}
分享到:
相关推荐
OpenCV实现的图像2D转3D Image-2D-to-3D.rar 图像2D转3D,基于VS2015+opencv。可以实现2d图像转3d图像的功能
this program show us a brief code for imageshowing under opencv
使用Opencv库实现多种类型图片批量互相转换,包括 tif bmp jpg pgm png五种类型的图片。
1、读取yuv.nv12文件转换成jpg格式文件输出; 2、通过封装opencv函数进行画框输出;
Learning Image Processing with OpenCV 英文原版pdf 及配套Code源码 本资源来自自网络,如有侵权,请联系上传者或csdn删除
Using openCV to load image, and transfer to gray and save image.
本代码修改了ImageJ的java代码,使其可以在C++上也能运行,只有少部分代码是基于OpenCV,大部分是基于STL
Image Watch VS2019 安装,OpenCV调试插件,ImageWatch2019.vsix 方便大家下载使用
Chapter 1, A Taste of Machine Learning, will gently introduce you to the different subfields of machine learning, and explain how to install OpenCV and other essential tools in the Python Anaconda ...
今天小编就为大家分享一篇Python OpenCV读取png图像转成jpg图像存储的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
在MFC中应用OpenCv。可以打开保存图片的基本程序框架。(想正确运行,请确保已装OpenCv并且已经和VC6正确连接)
OpenCV部署图像描述Image_Captioning包含C++和Python源码+模型+说明.zip
运行平台VS2013+OpenCV2.4.8,运行通过。
与直接用软件转化图片格式不用,此代码可以无损转换图片格式
基于opencv图像处理库的傅里叶变换,首先说明是pdf文件,但源码运行过了,是正确的。
opencv中Mat转换成内存数据的jpeg格式,以及显示在mfc的界面中
Abstract— Panoramic image mosaic is a technology to match a series of images which are overlapped with each other. Panoramic image mosaics can be used for different applications. Image mosaic has ...
C++在内存中将bmp转JPG。 VS2013,mfc,将大的bmp或者jpg用opencv读取、缩小后保存为bmp,再将bmp转jpg。jpg数据是在内存中的 bmp转jpg