简介:
将连续的图片转换成视频时,首先需要把图片全部读入,然后再做相应处理,该程序利用sprintf()函数,实现连续图片的读入
/*********新建QT控制台程序,实现多张连续图片的读取*********/ /******************2017年12月9日******************/ 源代码如下: #include <QCoreApplication> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <iostream> using namespace std; using namespace cv; int main() { char filename[76]; //定义数组,其中数组大小等于图片的个数 Mat image; for(unsigned int i=0;i<76;i++) { sprintf(filename,"/home/ttwang/images/image%d.jpg",i);//第二个参数是指定图片路径和图片名的一般式(image%d) image=imread(filename);//导入图片 imshow("image",image); waitKey(0); } }