ImageD  v2_7_5 (24.06.22)
ImageD is an image processing software designed for rapid prototyping and implementing algorithms and solutions for science, research and teaching.
d_videowriter.h
Go to the documentation of this file.
1 /************************************
2  * added: 21.04.2020 *
3  * author: David Eilenstein *
4  * contact: D.Eilenstein@gsi.de *
5  * project: ImageD *
6  * facility: GSI Darmstadt, Ger *
7  ************************************/
8 
9 #ifndef D_VIDEOWRITER_H
10 #define D_VIDEOWRITER_H
11 
12 //own
13 #include <d_enum.h>
14 #include <d_stat.h>
15 #include <d_component.h>
16 #include <d_component_list.h>
19 
20 //general
21 #include <iostream>
22 #include <vector>
23 #include <fstream>
24 #include <sstream>
25 #include <iterator>
26 #include <thread>
27 
28 //Qt
29 #include <QObject>
30 #include <QImage>
31 #include <QPainter>
32 #include <QPen>
33 #include <QColor>
34 #include <QFileInfo>
35 #include <QDir>
36 #include <QString>
37 #include <QDebug>
38 
39 //openCV
40 #include <opencv2/core/core.hpp>
41 #include <opencv2/highgui/highgui.hpp>
42 #include <opencv2/imgproc/imgproc.hpp>
43 
44 //namespaces
45 using namespace std;
46 //using namespace cv; (prohibited because of abigous names with qtdatavisualization)
47 #include <d_opencv_typedefs.h>
48 
53 {
54 public:
55  D_VideoWriter();
56 
57  //setter
58  int set_PathOut(string S_OutPath);
59  int set_PathOut(QString QS_OutPath);
60  int set_PathOut(QFileInfo FI_OutPath);
61  int set_Size(Size size_out);
62  int set_Size(int width, int height);
63  int set_FPS(double fps);
64  int set_isColor(bool is_color);
65  //void set_compression(bool compress) {prop_FourCC = compress ? prop_FourCC_compressed : prop_FourCC_full;}
66 
67  int init_VideoWriter();
68  bool is_Init();
69 
70  int AddFrame(Mat frame2add);
71  int AddFrame(Mat *frame2add);
72  int EndVideoWriting();
73 
74 private:
75 
76  //const int prop_FourCC_compressed = CV_FOURCC('a','v','c','1'); //is buggy...
77  const int prop_FourCC_full = CV_FOURCC('M','J','P','G');
78 
79  //Destination Information
80  QFileInfo FI_Out;
81  QDir DIR_Out;
82  Size prop_SizeOut = Size(1,1);
83  double prop_FPS = 24;
84  int prop_FourCC = prop_FourCC_full;
85  bool prop_isColor = true;
86 
87  //read video
88  VideoWriter VW_Destination;
89 
90  //States
91  bool state_isSet_DestinationPath = false;
92  bool state_isSet_FourCC = true;
93  bool state_isSet_FrameSize = false;
94  bool state_isSet_FPS = false;
95  bool state_isSet_isColor = false;
96  bool state_ready2write = false;
97  bool is_ready2write();
98  bool state_isInit = false;
99 };
100 
101 #endif // D_VIDEOWRITER_H
Mat
cv::Mat Mat
Definition: d_opencv_typedefs.h:28
ER_okay
@ ER_okay
Definition: d_enum.h:133
d_component.h
D_VideoWriter::set_Size
int set_Size(Size size_out)
Definition: d_videowriter.cpp:16
d_value_distribution_list.h
ER_channel_missmatch
@ ER_channel_missmatch
Definition: d_enum.h:145
ER_size_missmatch
@ ER_size_missmatch
Definition: d_enum.h:141
D_VideoWriter::init_VideoWriter
int init_VideoWriter()
Definition: d_videowriter.cpp:67
ER_file_not_exist
@ ER_file_not_exist
Definition: d_enum.h:161
d_component_list_context.h
VideoWriter
cv::VideoWriter VideoWriter
Definition: d_opencv_typedefs.h:25
D_VideoWriter::D_VideoWriter
D_VideoWriter()
Definition: d_videowriter.cpp:11
D_VideoWriter
The D_VideoWriter class Creates a video from a sequence of images and saves it as a file.
Definition: d_videowriter.h:53
D_VideoWriter::EndVideoWriting
int EndVideoWriting()
Definition: d_videowriter.cpp:133
D_VideoWriter::set_PathOut
int set_PathOut(string S_OutPath)
Definition: d_videowriter.cpp:140
D_VideoWriter::set_FPS
int set_FPS(double fps)
Definition: d_videowriter.cpp:42
d_component_list.h
ER_other
@ ER_other
Definition: d_enum.h:134
d_opencv_typedefs.h
d_enum.h
D_VideoWriter::AddFrame
int AddFrame(Mat frame2add)
Definition: d_videowriter.cpp:101
ER_parameter_bad
@ ER_parameter_bad
Definition: d_enum.h:142
D_VideoWriter::is_Init
bool is_Init()
Definition: d_videowriter.cpp:90
d_videowriter.h
D_VideoWriter::set_isColor
int set_isColor(bool is_color)
Definition: d_videowriter.cpp:56
Size
cv::Size Size
Definition: d_opencv_typedefs.h:31
d_stat.h
ER_empty
@ ER_empty
Definition: d_enum.h:135