39 using directx_camera_server_ptr = std::unique_ptr<directx_camera_server>;
43 : m_camera(std::move(cam)) {
44 m_camera->read_image_to_memory();
45 if (m_camera->isOpened()) {
51 bool ok()
const override {
52 return m_camera && m_gotRes && m_camera->working() &&
62 directx_camera_server_ptr m_camera;
63 bool m_gotRes =
false;
67 ImageSourcePtr openHDKCameraDirectShow(
bool highGain) {
68 auto ret = ImageSourcePtr{};
69 auto cam = getDirectShowHDKCamera(highGain);
76 static const auto UPDATER_URL =
"osvr.github.io";
77 auto firmwareStatus = checkCameraFirmwareRevision(cam->getPath());
78 switch (firmwareStatus) {
79 case osvr::vbtracker::FirmwareStatus::Good:
81 case FirmwareStatus::Future:
83 <<
"\n[Video-based Tracking] Note: Camera firmware "
84 "version detected was newer than recognized latest "
85 "version, assuming OK. You may want to update your "
86 "OSVR server or plugin!\n"
89 case osvr::vbtracker::FirmwareStatus::UpgradeRequired:
90 case osvr::vbtracker::FirmwareStatus::UpgradeUseful:
92 <<
"\n[Video-based Tracking] WARNING - Your HDK infrared "
93 "tracking camera was detected to have outdated "
94 "firmware in need of updating, and may not function "
95 "properly. Please visit "
96 << UPDATER_URL <<
" to get the "
97 "camera firmware updater.\n\n"
102 case osvr::vbtracker::FirmwareStatus::Unknown:
104 <<
"\n[Video-based Tracking] Note: Could not detect the "
105 "firmware version on your HDK infrared "
106 "tracking camera. You may need to update it: see "
107 << UPDATER_URL <<
" to get the camera firmware updater.\n\n"
114 if (firmwareStatus ==
115 osvr::vbtracker::FirmwareStatus::UpgradeRequired) {
118 std::cerr <<
"\n[Video-based Tracking] The video tracking "
119 "plugin cannot run with your camera until the "
120 "firmware has been updated.\n\n"
125 ret.reset(
new DirectShowImageSource{std::move(cam)});
130 return m_camera->read_image_to_memory();
135 timestamp = m_camera->get_buffer_timestamp();
139 void DirectShowImageSource::storeRes() {
140 int minx, miny, maxx, maxy;
141 m_camera->read_range(minx, maxx, miny, maxy);
142 m_res = cv::Size(maxx - minx + 1, maxy - miny + 1);
cv::Size resolution() const override
Get resolution of the images from this source.
void retrieveColor(cv::Mat &color, osvr::util::time::TimeValue ×tamp) override
virtual void retrieve(cv::Mat &color, cv::Mat &gray, osvr::util::time::TimeValue ×tamp)
Call after grab() to get the actual image data.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...