OSVR-Core
ImageSource.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_ImageSource_h_GUID_C1B68116_0322_4DBD_2360_EF4E6A81D5F4
26 #define INCLUDED_ImageSource_h_GUID_C1B68116_0322_4DBD_2360_EF4E6A81D5F4
27 
28 // Internal Includes
29 // - none
30 
31 // Library/third-party includes
32 #include <opencv2/core/core.hpp>
33 
34 // Standard includes
35 #include <memory>
36 
37 namespace osvr {
38 namespace vbtracker {
41  class ImageSource {
42  public:
44  virtual ~ImageSource();
45 
47  virtual bool ok() const = 0;
48 
55  virtual bool grab() = 0;
56 
58  virtual void retrieve(cv::Mat &color, cv::Mat &gray);
59 
61  virtual cv::Size resolution() const = 0;
62 
66  virtual void retrieveColor(cv::Mat &color) = 0;
67 
68  protected:
69  ImageSource() = default;
70  };
71 
72  using ImageSourcePtr = std::unique_ptr<ImageSource>;
73 } // namespace vbtracker
74 } // namespace osvr
75 #endif // INCLUDED_ImageSource_h_GUID_C1B68116_0322_4DBD_2360_EF4E6A81D5F4
virtual bool ok() const =0
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
virtual bool grab()=0
Trigger camera capture.
virtual ~ImageSource()
Destructor.
Definition: ImageSource.cpp:36
virtual void retrieve(cv::Mat &color, cv::Mat &gray, osvr::util::time::TimeValue &timestamp)
Call after grab() to get the actual image data.
Definition: ImageSource.cpp:37
virtual void retrieveColor(cv::Mat &color, osvr::util::time::TimeValue &timestamp)=0
For those devices that naturally read a non-corrupt color image, overriding just this method will let...
virtual cv::Size resolution() const =0
Get resolution of the images from this source.