当前位置:网站首页>learning opencv3_2-11_写入AVI文件
learning opencv3_2-11_写入AVI文件
2022-07-21 05:04:00 【Amelie_11】
一个完整的读取彩色视频并转换为对数极坐标视频的程序
#include <opencv2/opencv.hpp>
#include <iostream>
//
//void help(char** argv ) {
// std::cout << "\n"
// << "Read in a video, write out a log polar of it\n"
// << argv[0] <<" <path/video> <paht/video_output>\n"
// << "For example:\n"
// << argv[0] << " ../tree.avi ../vout.avi\n"
// << "\nThen read it with:\n ./example_02-10 ../vout.avi\n"
// << std::endl;
//}
int main(int argc, char** argv) {
//if (argc != 3) {
// help(argv);
// return 0;
//}
cv::namedWindow("Example 2-11", cv::WINDOW_AUTOSIZE);
cv::namedWindow("Log_Polar", cv::WINDOW_AUTOSIZE);
// ( Note: could capture from a camera by giving a camera id as an int.)
//
cv::VideoCapture capture("C:\\Users\\oh_clm\\Videos\\Captures\\test.mp4");
double fps = capture.get(cv::CAP_PROP_FPS);
cv::Size size(
(int)capture.get(cv::CAP_PROP_FRAME_WIDTH),
(int)capture.get(cv::CAP_PROP_FRAME_HEIGHT)
);
cv::VideoWriter writer;
writer.open("C:\\Users\\oh_clm\\Desktop\\LearningOpenCV3\\Learning-OpenCV-3_examples-master\\test_01.avi",cv::CAP_OPENCV_MJPEG, fps, size);
cv::Mat logpolar_frame, bgr_frame;
for (;;) {
capture >> bgr_frame;
if (bgr_frame.empty()) break; // end if done
cv::imshow("Example 2-11", bgr_frame);
cv::logPolar(
bgr_frame, // Input color frame
logpolar_frame, // Output log-polar frame
cv::Point2f( // Centerpoint for log-polar transformation
bgr_frame.cols / 2, // x
bgr_frame.rows / 2 // y
),
40, // Magnitude (scale parameter)
cv::WARP_FILL_OUTLIERS // Fill outliers with 'zero'
);
cv::imshow("Log_Polar", logpolar_frame);
writer << logpolar_frame;
char c = cv::waitKey(10);
if (c == 27) break; // allow the user to break out
}
writer.release();
capture.release();
}
参照书本代码,以及参考了csdn上的一些文章。
写的很好的一篇:https://blog.csdn.net/weixin_48524215/article/details/120392341?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163871170016780271988970%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=163871170016780271988970&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-2-120392341.first_rank_v2_pc_rank_v29&utm_term=opencv3+%E5%86%99%E5%85%A5AVI%E6%96%87%E4%BB%B6&spm=1018.2226.3001.4187
另一篇参考链接:https://blog.csdn.net/qq_33831881/article/details/106093304?ops_request_misc=&request_id=&biz_id=102&utm_term=opencv3%20%E5%86%99%E5%85%A5AVI%E6%96%87%E4%BB%B6&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-3-106093304.first_rank_v2_pc_rank_v29&spm=1018.2226.3001.4187
几个问题;
1、CV_FOURCC(‘M’,‘J’,‘P’,‘G’)用cv::CAP_OPENCV_MJPEG代替
2、cv::CAP_PROP_FPS代替CV_CAP_PROP_FPS
边栏推荐
- 深度剖析 string —— memset & memcmp
- M-ary to n-ary
- DataLossError : corrupted record at XXXXXXX,BERT预训练报错
- bert从入门到实践笔记本
- mac brew install mysql 安装步骤
- [PCB] modify the default settings for items such as (via) (text string) (wiring linear dimension) in Altium designer
- Isempty and isblank
- pytorch安装
- ES聚合统计语法
- Pytorch advanced training skills
猜你喜欢
(笔记)吴恩达深度学习L4卷积神经网络W1
[record] the operation of optisystem is stuck, and it is unable to click to close, input variable values and other solutions
OPT101单片光电二极管和单电源互阻放大器使用说明
ESP8266固件下载及烧录(收录AT固件下载地址+固件烧录注意事项)
做题引发对getchar()的理解
P1364 医院设置
让代码解决《线性代数》系列 - 多项式求和
合泰HT32--淘晶驰TJC--T0串口屏学习笔记(二)
Initializing libiomp5.dylib, but found libomp.dylib already initialized
[PCB] Based on Hetai ht32f52352 chip circuit board drawing experiment (WiFi and optical sensor module) - drawing board notes
随机推荐
Pycharm notes
(环境配置)TDD-net
[PCB] Based on stm32f103rct6 rocker - Bluetooth Module Development Board - drawing Board note arrangement
C. Binary String(求前缀和)
Glory mobile refrigerator app activation
【PCB】基於STM32F103RCT6搖杆-藍牙模塊開發板-畫板筆記整理
[PCB] Based on stm32f103rct6 joystick - Bluetooth module development board - drawing board notes sorting
深度剖析 string —— memset & memcmp
Hetai ht32--4spi drive 0.96 inch OLED display implementation
Comparison of three methods of converting string: (string), toString (), string valueOf()
使用Arduino搭建基于阿里云平台的物联网智能家居
洛谷P1119 灾后重建(Floyd)
【记录】Optisystem运行卡死,无法点击关闭、输入变量数值等问题解决方法
bert从入门到实践笔记本
Checkpoint in the deep learning source code project
2. Learn the vector calculation of paddlepaddle from scratch
OLED(经典0.96英寸)--4SPI--SSD1306控制原理(含常用芯片_oled例程)
MMdetection环境搭配(cuda10.1+mmdet2.24)
[3D modeling] SolidWorks 3D modeling and prusaslicer slice printing learning notes
n-gram