Image Utilities (IU)
 All Data Structures Namespaces Functions Variables Typedefs Enumerations Friends Groups Pages
opencvsource.h
1 #pragma once
2 
3 #include "videosource.h"
4 #include <string>
5 
6 namespace iu {
7 
17 class OpenCVSource : public VideoSource
18 {
19 public:
20 
26  OpenCVSource(unsigned int camId=0, bool gray=true);
27 
33  OpenCVSource(const std::string& filename, bool gray=true);
34  virtual ~OpenCVSource();
35 
40  cv::Mat getImage();
41 
46  unsigned int getWidth() { return width_; }
47 
52  unsigned int getHeight() { return height_; }
53 
58  unsigned int getCurrentFrameNr() { return frameNr_; }
59 
60 private:
61 
62  cv::VideoCapture* videocapture_;
63  int numFrames_;
64 
65  cv::Mat frame_;
66  bool gray_;
67 };
68  // end of videoIO
70 
71 
72 
73 } // namespace iu
74 
75 
76 
The VideoSource class is the abstract base class for video input.
Definition: videosource.h:17
cv::Mat getImage()
get new image
The OpenCVSource class uses OpenCV to read images from cameras or files.
Definition: opencvsource.h:17
unsigned int getHeight()
get image height
Definition: opencvsource.h:52
OpenCVSource(unsigned int camId=0, bool gray=true)
OpenCVSource constructor. Initialize the camera camId.
unsigned int getCurrentFrameNr()
get frame index. Upon camera initilaization, the counter is set to 0
Definition: opencvsource.h:58
unsigned int getWidth()
get image width
Definition: opencvsource.h:46