视频读取与新建
来源:互联网 发布:淘宝无需物流怎么设置 编辑:程序博客网 时间:2024/05/20 05:58
#include"highgui.h"
#include"cv.h"
IplImage *doPyrDown(IplImage *in, int filter = IPL_GAUSSIAN_5x5){
assert(in->width % 2 == 0 && in->height % 2 == 0);
IplImage *out = cvCreateImage(cvSize(in->width / 2, in->height / 2),
in->depth,
in->nChannels);
cvPyrDown(in, out);
return out;
}
int main(int argc, char **argv){
CvCapture *capture = 0;
capture = cvCreateFileCapture("30.avi");//read the origion
if (!capture)//if the video is empty,then end program
return -1;
//the following steps are to get properties of capture;
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)
);
//now begin create new video,you must named it;
CvVideoWriter *writer = cvCreateVideoWriter(
"try.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);
cvWaitKey(0);
return (0);
}
#include"cv.h"
IplImage *doPyrDown(IplImage *in, int filter = IPL_GAUSSIAN_5x5){
assert(in->width % 2 == 0 && in->height % 2 == 0);
IplImage *out = cvCreateImage(cvSize(in->width / 2, in->height / 2),
in->depth,
in->nChannels);
cvPyrDown(in, out);
return out;
}
int main(int argc, char **argv){
CvCapture *capture = 0;
capture = cvCreateFileCapture("30.avi");//read the origion
if (!capture)//if the video is empty,then end program
return -1;
//the following steps are to get properties of capture;
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)
);
//now begin create new video,you must named it;
CvVideoWriter *writer = cvCreateVideoWriter(
"try.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);
cvWaitKey(0);
return (0);
}
0 0
- 视频读取与新建
- 视频流读取与视频帧处理
- opencv读取视频与摄像头
- matlab中视频的读取与显示
- opencv之视频读取与文件存储
- 视频的读取与保存opencv
- 视频读取
- 读取视频
- 读取视频
- VC2010 新建项目示例视频
- Silverlight读取Zip文件中的图片与视频
- Silverlight读取Zip文件中的图片与视频
- OpenCV2学习笔记(九):视频流读取与处理
- opencv学习笔记(三)-读取视频与摄像头
- 带进度条控制的视频读取与存储
- OpenCV(学习笔记6)-视频读取与显示
- opnecv 读取视频与图像还是有区别的
- C/C++ OpenCV读取视频与调用摄像头
- 快速排序代码,熟记
- 11.26-----总结前天的Python(x,y)的安装以及Anaconda,Theano的安装。
- EntropyService分析
- 移动端ViewPort的故事(二)
- 国密SKF接口函数介绍之四:文件管理函数
- 视频读取与新建
- 触发器实现跨库同步(存储过程同步)
- 在git hub上面写android / ios的 sample code 集合。
- android的R.java无法修改解决!
- Linux 发现了一个好玩的东西, 反引号``
- hadoop之partitioner编程
- Thinking in Java 整理笔记:类型信息
- Box2dFlash应用坑——刚体始终锁定旋转角度
- 在git hub上面写android / ios的 sample code 集合。