ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkOpenCVVideoIO.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkOpenCVVideoIO_h
19#define itkOpenCVVideoIO_h
20
21#include "itkVideoIOBase.h"
22
23#include "opencv2/videoio.hpp"
24
25#include "ITKVideoBridgeOpenCVExport.h"
26
27
28namespace itk
29{
37class ITKVideoBridgeOpenCV_EXPORT OpenCVVideoIO : public VideoIOBase
38{
39public:
40 ITK_DISALLOW_COPY_AND_MOVE(OpenCVVideoIO);
41
46
51
53 itkNewMacro(Self);
54
56 itkOverrideGetNameOfClassMacro(OpenCVVideoIO);
57
59 virtual void
61
62 //
63 // Data reading-related methods
64 //
65
67 virtual void
69
71 virtual void
73
76 virtual bool
77 CanReadFile(const char *);
78
80 virtual bool
81 CanReadCamera(CameraIDType cameraID) const;
82
84 virtual void
86
88 virtual void
89 Read(void * buffer);
90
93 virtual bool
95
97 virtual TemporalOffsetType
99 virtual TemporalRatioType
100 GetRatio() const;
101 virtual FrameOffsetType
103 virtual TemporalRatioType
105 virtual FrameOffsetType
107 virtual FrameOffsetType
109 virtual FrameOffsetType
111
112 //
113 // Data writing-related methods
114 //
115
117 virtual void
119 virtual CameraIDType
121
124 virtual double
125 GetSpacing(unsigned int itkNotUsed(i)) const
126 {
127 return 1.0;
128 }
129 virtual double
130 GetOrigin(unsigned int itkNotUsed(i)) const
131 {
132 return 0.0;
133 }
134 virtual std::vector<double>
135 GetDirection(unsigned int i) const
136 {
137 return this->GetDefaultDirection(i);
138 }
139
142 virtual bool
143 CanWriteFile(const char *);
144
147 virtual void
149
152 virtual void
153 Write(const void * buffer);
154
156 virtual void
158 const std::vector<SizeValueType> & dim,
159 const char * fourCC,
160 unsigned int nChannels,
161 IOComponentEnum componentType);
162
163protected:
166
167 void
168 PrintSelf(std::ostream & os, Indent indent) const override;
169
171 void
173
175 void
177
179 void
181
183 void
185
186private:
187 cv::Mat m_CVImage{};
188 cv::VideoCapture m_Capture{};
189 cv::VideoWriter m_Writer{};
190 int m_FourCC{};
191
193};
194} // end namespace itk
195
196#endif // itkOpenCVVideoIO_h
virtual std::vector< double > GetDefaultDirection(unsigned int k) const
Control indentation during Print() invocation.
Definition itkIndent.h:51
virtual void SetWriterParameters(TemporalRatioType fps, const std::vector< SizeValueType > &dim, const char *fourCC, unsigned int nChannels, IOComponentEnum componentType)
virtual void SetCameraIndex(CameraIDType idx)
cv::VideoCapture m_Capture
virtual void WriteImageInformation()
void UpdateReaderProperties()
virtual CameraIDType GetCameraIndex() const
virtual FrameOffsetType GetCurrentFrame() const
Superclass::CameraIDType CameraIDType
virtual bool SetNextFrameToRead(FrameOffsetType frameNumber)
virtual FrameOffsetType GetIFrameInterval() const
virtual bool CanReadFile(const char *)
virtual FrameOffsetType GetFrameTotal() const
virtual FrameOffsetType GetLastIFrame() const
virtual bool CanReadCamera(CameraIDType cameraID) const
Superclass::TemporalRatioType TemporalRatioType
virtual void Write(const void *buffer)
virtual TemporalRatioType GetFramesPerSecond() const
virtual double GetSpacing(unsigned int i) const
virtual void SetReadFromCamera()
cv::VideoWriter m_Writer
virtual void SetReadFromFile()
Superclass::TemporalOffsetType TemporalOffsetType
virtual TemporalOffsetType GetPositionInMSec() const
Superclass::FrameOffsetType FrameOffsetType
virtual std::vector< double > GetDirection(unsigned int i) const
virtual bool CanWriteFile(const char *)
virtual void FinishReadingOrWriting()
virtual void Read(void *buffer)
virtual void ReadImageInformation()
SmartPointer< Self > Pointer
virtual double GetOrigin(unsigned int i) const
virtual TemporalRatioType GetRatio() const
void PrintSelf(std::ostream &os, Indent indent) const override
Implements transparent reference counting.
SizeValueType CameraIDType
SizeValueType FrameOffsetType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
CommonEnums::IOComponent IOComponentEnum