30 #include <opencv2/imgproc/imgproc.hpp>
40 : m_camera(std::move(cam)) {
47 bool ok()
const override {
return m_camera && m_camera->ok(); }
49 void retrieve(cv::Mat &color, cv::Mat &gray,
56 ImageSourcePtr m_camera;
58 std::unique_ptr<oculus_dk2::Oculus_DK2_HID> m_hid;
61 ImageSourcePtr openDK2WrappedCamera(ImageSourcePtr &&cam,
bool doHid) {
62 auto ret = ImageSourcePtr{};
67 ret.reset(
new DK2WrappedImageSource(std::move(cam), doHid));
75 return m_camera->grab();
82 m_camera->retrieveColor(m_scratch, timestamp);
84 gray = osvr::oculus_dk2::unscramble_image(m_scratch);
85 cv::cvtColor(gray, color, CV_GRAY2RGB);
97 return m_camera->resolution();
void retrieve(cv::Mat &color, cv::Mat &gray, osvr::util::time::TimeValue ×tamp) override
Call after grab() to get the actual image data.
cv::Size resolution() const override
Get resolution of the images from this source.
Header file describing interface for an Oculus DK2 device.
void retrieveColor(cv::Mat &color, osvr::util::time::TimeValue ×tamp) override
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...