⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ppm2avi.cc

📁 torch tracking code, it is a good code
💻 CC
字号:
const char *help = "\progname: ppm2avi.cc\n\code2html: This program makes a video from ppm images.\n\version: Torch3 vision2.0, 2004-2005\n\(c) Sebastien Marcel (marcel@idiap.ch)\n";#include "ImageRgb.h"#include "ffmpegVideoFile.h"#include "DiskXFile.h"#include "FileListCmdOption.h"#include "CmdLine.h"using namespace Torch;int main(int argc, char **argv){	int width;	int height;	int fps;	int bitrate;	char *output_filename;	bool verbose;  	FileListCmdOption input_file_list("filename", "the list of inputs files or one data file");  	input_file_list.isArgument(true);	// Construct the command line  	CmdLine cmd;	cmd.setBOption("write log", false);	  	// Put the help line at the beginning  	cmd.info(help);  	cmd.addText("\nArguments:");	cmd.addCmdOption(&input_file_list);  	cmd.addICmdArg("width", &width, "width");  	cmd.addICmdArg("height", &height, "height");  	cmd.addText("\nOptions:");  	cmd.addBCmdOption("-verbose", &verbose, false, "verbose");  	cmd.addICmdOption("-fps", &fps, 25, "verbose");  	cmd.addSCmdOption("-o", &output_filename, "output.avi", "verbose");  	cmd.addICmdOption("-bitrate", &bitrate, 1000000, "bitrate for encoding");	cmd.read(argc, argv);	VideoFile *video = NULL;	video = new ffmpegVideoFile();        video->open(output_filename, "w");	video->setIOption("width", width);	video->setIOption("height", height);	video->setROption("framerate", fps);	video->setIOption("bitrate", bitrate);	Image *image = new ImageRgb(width, height);			int nframes = input_file_list.n_files;	for(int i = 0 ; i < nframes ; i++)	{   			image->load(input_file_list.file_names[i]);		if((image->width != width) || (image->height != height))		{			warning("error incorrect image size.");						delete image;			video->close();			delete video;			return 1;		}		 		if(verbose) print("r");					video->write(image->pixmap);		if(verbose) print("w");		real percent = 100.0 * (i+1) / nframes;		print("%03d%\r", (int) percent);	}	print("\n");			video->close();	delete image;	delete video;	return(0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -