色彩视频文件转换为灰度格式
2013-09-04 15:05
218 查看
// video.cpp : Defines the entry point for the console application. //convert a video to grayscale //argv[1]: input video file //argv[2]: name of new output file #include <cv.h> #include <cvaux.h> #include <highgui.h> #pragma comment(lib, "ml.lib") #pragma comment(lib, "cv.lib") #pragma comment(lib, "cvaux.lib") #pragma comment(lib, "cvcam.lib") #pragma comment(lib, "cxcore.lib") #pragma comment(lib, "cxts.lib") #pragma comment(lib, "highgui.lib") #pragma comment(lib, "cvhaartraining.lib") int main(int argc, char* argv[]) { CvCapture* capture = 0; capture = cvCreateFileCapture("D:\\clock.avi"); if(!capture) { return -1; } //init the video read IplImage* bgr_frame = cvQueryFrame(capture); double fps = cvGetCaptureProperty(capture, CV_CAP_PROP_FPS); CvSize size = cvSize( (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH), (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT) ); CvVideoWriter *writer = cvCreateVideoWriter( "result.avi", CV_FOURCC('M', 'J', 'P', 'G'), fps, size ); IplImage* logpolar_frame = cvCreateImage( size, IPL_DEPTH_8U, 3 ); while ((bgr_frame = cvQueryFrame(capture)) != NULL) { cvLogPolar(bgr_frame, logpolar_frame, cvPoint2D32f(bgr_frame->width/2, bgr_frame->height/2), 40, CV_INTER_LINEAR + CV_WARP_FILL_OUTLIERS); cvWriteFrame(writer, logpolar_frame); } cvReleaseVideoWriter(&writer); cvReleaseImage(&logpolar_frame); cvReleaseCapture(&capture); return 0; }注:安装了K-Lite codec Pack,可以读文件,"result.avi“文件为0KB.未解决····
http://fileforum.betanews.com/download/KLite-Codec-Pack_Full/1094057842/3
相关文章推荐
- 实现读入一个彩色视频文件并以灰度格式输出这个视频文件,学习opencv例2-10
- OpenCV中,将一个彩色视频文件以灰度格式输出
- 关于ffmpeg 的总结(一个linux 下 集 屏幕录像录音,音频视频转换,合并音频视频文件,格式转换于一身的命令)
- [转]关于ffmpeg 的总结(一个linux 下 集 屏幕录像录音,音频视频转换,合并音频视频文件,格式转换于一身的命令)
- 用java程序调用ffmpeg执行视频文件格式转换flv
- [Gstreamer][Bash Script]转换任意视频到ios支持的mp4文件格式
- Opencv中的Bug(实现读入一个彩色视频文件并以灰度格式输出这个视频文件,学习opencv例2-10)
- iOS开发 mov视频文件转换成其他视频文件格式
- Android将本地视频文件转换为一帧帧的JPEG NV21 I420格式的文件
- java程序调用ffmpeg执行视频文件格式转换flv
- 关于ffmpeg 的总结(一个linux下集屏幕录像录音,音频视频转换,合并音频视频文件,格式转换于一身的命令)
- 用java程序调用ffmpeg执行视频文件格式转换flv
- 截取视频文件第一桢的图片和转换视频格式文件为flv(支持文件格式:asf,avi,mpg,flv,3gp,mov,wmv)
- opencv视频格式转换出现色彩异常的处理
- 视频教程:打印和文件格式转换
- 截取视频文件第一桢的图片和转换视频格式文件为flv(支持文件格式:asf,avi,mpg,flv,3gp,mov,wmv)
- 色彩视频文件转换为灰度格式
- 将视频转换为 HLS(HTTP Live Streaming) 协议格式文件
- 用java程序调用ffmpeg执行视频文件格式转换flv
- 应用ffmpeg进行视频文件格式转换