32 #include <opencv2/highgui/highgui.hpp>
40 static const std::string
41 windowNameAndInstructions(
"OSVR imaging demo | q or esc to quit");
43 bool gotSomething =
false;
54 std::cout <<
"Error, frame empty!" << std::endl;
61 std::cout <<
"Got first report: image is " << frame.cols <<
"x"
62 << frame.rows << std::endl;
65 cv::imshow(windowNameAndInstructions, frame);
84 std::cout << std::endl << windowNameAndInstructions << std::endl;
88 cv::namedWindow(windowNameAndInstructions);
91 char key =
static_cast<char>(cv::waitKey(1));
92 if (
'q' == key ||
'Q' == key || 27 == key) {
97 std::cout <<
"Library shut down, exiting." << std::endl;
Interface handle object. Typically acquired from a ClientContext.
Client context object: Create and keep one in your application. Handles lifetime management and provi...
The user-friendly imaging report. Note that passing this around by value is OK (doesn't copy the imag...
ImageBufferPtr buffer
A shared pointer with custom deleter that owns the underlying image data buffer for the frame...
int computeOpenCVMatType(OSVR_ImagingMetadata const &metadata)
Computes the OpenCV matrix type (as in CV_8UC3) from a metadata struct.
Interface getInterface(const std::string &path)
Get the interface associated with the given path.
OSVR_ImagingMetadata metadata
Metadata containing the properties of this frame.
void update()
Updates the state of the context - call regularly in your mainloop.
void imagingCallback(void *userdata, osvr::util::time::TimeValue const ×tamp, osvr::clientkit::ImagingReport report)
Header containing the inline implementation of Interface.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...