国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C++ > 正文

opencv3/C++ 將圖片轉(zhuǎn)換為視頻的實例

2020-01-26 13:23:00
字體:
供稿:網(wǎng)友

現(xiàn)有一些圖片按順序放置在一文件夾jogging1/下,如圖:

需要將其合并轉(zhuǎn)換為一個視頻。

示例:

環(huán)境:Win7+OpenCV3+VS2012

#include<opencv2/opencv.hpp>#include <stdio.h>#include <io.h>#include <string>#include <iostream> #include <fstream> using namespace std;using namespace cv;int main(){  _finddata_t FileInfo;   //讀取圖片所在的路徑  string inPath = "E://image//yu//jogging1//";   string strfind = inPath + "*";  long Handle = _findfirst(strfind.c_str(), &FileInfo);  char filename[300];  Mat src;  if (Handle == -1L)  {     cerr << "can not match the folder path" << endl;     exit(-1);  }  Mat frame;  Mat src0 = imread("E:/image/yu/jogging1/0000.jpg");  Size size = src0.size();  VideoWriter writer;  writer.open("jogging.avi", CV_FOURCC('M', 'J', 'P', 'G'), 25, size, true);  do{    //判斷是否有子目錄    if (FileInfo.attrib & _A_SUBDIR)     {       if ((strcmp(FileInfo.name, ".") != 0) && (strcmp(FileInfo.name, "..") != 0))       {         inPath += FileInfo.name;        cout <<inPath<<endl;       }    }    else    {      cout <<inPath<<FileInfo.name<<endl;      //讀取圖片所在的路徑      string path = "E:/image/yu/jogging1/" + (string)FileInfo.name;      src = imread(path);      imshow("input", src);      writer.write(src);      waitKey(1);    }   } while (_findnext(Handle, &FileInfo) == 0);   _findclose(Handle);    return 0; }

以上這篇opencv3/C++ 將圖片轉(zhuǎn)換為視頻的實例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持武林網(wǎng)。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 平乐县| 沁水县| 安仁县| 平定县| 潜江市| 永春县| 高碑店市| 娄底市| 达拉特旗| 江阴市| 江都市| 平湖市| 丰县| 延安市| 习水县| 宝坻区| 罗定市| 尚志市| 镇宁| 昌乐县| 清原| 临泉县| 桐梓县| 平塘县| 湾仔区| 湖南省| 南雄市| 读书| 高邮市| 大名县| 师宗县| 晴隆县| 铜梁县| 梁山县| 东山县| 壶关县| 鞍山市| 乐陵市| 大庆市| 大庆市| SHOW|