-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitkOpenCVWriter.h
More file actions
93 lines (74 loc) · 2.76 KB
/
itkOpenCVWriter.h
File metadata and controls
93 lines (74 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "itkVideoWriterBase.h"
#include "itkExceptionObject.h"
#include "cv.h"
#include "highgui.h"
#ifndef __itkOpenCVWriter_h
#define __itkOpenCVWriter_h
namespace itk
{
/** \class OpenCVWriter
* \brief
*
*
* \sa VideoWriterBase
*
* \ingroup OpenCVFilters
*/
template <class TImage>
class ITK_EXPORT OpenCVWriter : public VideoWriterBase < TImage >
{
public:
/** Standard class typedefs. **/
typedef OpenCVWriter Self;
typedef VideoWriterBase<TImage> Superclass;
typedef SmartPointer< Self > Pointer;
typedef TImage ImageType;
typedef typename ImageType::PixelType PixelType;
/** Runtime type information (and related methods). **/
itkTypeMacro(OpenCVWriter, Superclass);
/** Method for creation through the object factory. **/
itkNewMacro(Self);
/** Try to Write a video **/
/** Return true if in case of a success, false for a faillure **/
bool OpenWriter (const char* filename, typename itk::Image<typename TImage::PixelType,2>::Pointer ITKImage);
/** Try to close a video **/
/** Return true if in case of a success, false for a faillure **/
bool Close (const char* filename);
/** Return the state of the video (opened or not) **/
bool IsWriterOpen () {return this->m_WriterOpen;};
/** Write a frame and return true if succeed (false otherwise) **/
bool Write (typename ImageType::Pointer ITKImage);
/** A bunch of accessor **/
int GetWidth() {return this->m_Width;};
int GetHeight() {return this->m_Height;};
double GetXSpacing() {return this->m_Spacing[0];};
double GetYSpacing() {return this->m_Spacing[1];};
double GetPositionInMSec () {return this->m_PositionInMSec;};
double GetRatio () {return this->m_Ratio;};
unsigned long GetFrameTotal () {return this->m_FrameTotal;};
double GetFpS() {return this->m_FpS;};
protected:
OpenCVWriter();
~OpenCVWriter(){};
void PrintSelf(std::ostream & os, Indent indent) const;
private:
OpenCVWriter(const Self &); //purposely not implemented
void operator=(const Self &); //purposely not implemented
void UpdateProperties ();
IplImage *m_CVImage;
IplImage *m_Temp;
CvVideoWriter *m_Writer;
bool m_WriterOpen;
int m_FourCC;
double m_FpS;
int m_Width;
int m_Height;
itk::Size<2> m_Size;
itk::Index<2> m_Start;
itk::ImageRegion<2> m_Region;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkOpenCVWriter.txx"
#endif
#endif // __itkOpenCVWriter_h