CAVAPA-GUI  30.5.2014
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
captureinterface.h
1 /****************************************************************************
2  * Copyright (c) 2014, Joel Kivelä, Erkki Koskenkorva, Oskari Leppäaho,
3  * Mika Lehtinen and Petri Partanen.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * * Neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 ****************************************************************************/
30 #ifndef CAPTUREINTERFACE_H
31 #define CAPTUREINTERFACE_H
32 
33 #include "../common.h"
34 
35 namespace cavapa_gui
36 {
48 {
49 public:
50  CaptureInterface() {}
51  virtual ~CaptureInterface() {}
52 
57 
62  virtual double getBarrelCorrection() = 0;
63 
69  virtual FrameCapture getBuffered() = 0;
70 
77  virtual std::string getDescription() const = 0;
78 
84  virtual int getDeviceID() const = 0;
85 
90  virtual double getFramerate() const = 0;
91 
99  virtual int getMissedFrames() const = 0;
100 
115  virtual FrameCapture getNext(bool skip, bool* error) = 0;
116 
121  virtual std::string getPath() const = 0;
122 
127  virtual cv::Size getResolution() const = 0;
128 
135  virtual int getRetrievedFrames() const = 0;
136 
140  enum class INTERFACE_TYPE {
141  HTTP, // HTTP-protocol (libcurl).
142  OPENCV // OpenCV library (OpenCV).
143  };
144 
149  virtual INTERFACE_TYPE getType() const = 0;
150 
158  virtual bool hasNew() = 0;
159 
164  virtual bool isOpen() const = 0;
165 
171  virtual bool open(const std::string& path) = 0;
172 
177  virtual void resetStats() = 0;
178 
183  virtual void setBarrelCorrection(double amount) = 0;
184 
190  virtual bool setResolution(const cv::Size& new_size) = 0;
191 };
192 } // namespace
193 
194 #endif // CAPTUREINTERFACE_H
virtual double getBarrelCorrection()=0
Retrieves the barrel correction applied to the source.
virtual double getFramerate() const =0
Retrieves the capture device framerate.
DISALLOW_COPY_AND_ASSIGN(CaptureInterface)
Copy and assign of the class is not allowed.
virtual void setBarrelCorrection(double amount)=0
Sets the amount of the barrel correction to be applied.
Interface for the capture devices.
Definition: captureinterface.h:47
virtual bool setResolution(const cv::Size &new_size)=0
Sets the capturing device resolution.
virtual int getMissedFrames() const =0
Retrieves the logged frame misses.
virtual int getDeviceID() const =0
Returns the ID number the device was initialized with.
virtual std::string getDescription() const =0
Retrieves the description of the device.
virtual cv::Size getResolution() const =0
Retrieves the capture device resolution.
virtual FrameCapture getNext(bool skip, bool *error)=0
Retrieves the next frame.
The structure is used for storing a single source frame.
Definition: common.h:241
virtual void resetStats()=0
Resets the statistical counters.
virtual bool open(const std::string &path)=0
Opens the video file or the stream.
virtual bool hasNew()=0
Checks whether the device has a new image to retrieve or not.
virtual int getRetrievedFrames() const =0
Retrieves the total logged frames.
virtual bool isOpen() const =0
Checks whether the capturing device is open or not.
virtual std::string getPath() const =0
Retrieves the path given during the initialization.
virtual INTERFACE_TYPE getType() const =0
Retrieves the type of the device.
INTERFACE_TYPE
Used to define the type of source interface.
Definition: captureinterface.h:140
virtual FrameCapture getBuffered()=0
Retrieves the currently buffered frame.