MCPcopy Create free account
hub / github.com/OSVR/OSVR-Core / main

Function main

examples/clients/Imaging.cpp:64–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 lastReport = report;
63}
64int main() {
65 osvr::clientkit::ClientContext context("com.osvr.exampleclients.Imaging");
66
67 osvr::clientkit::Interface camera = context.getInterface("/camera");
68
69 /// We keep a copy of the last report to avoid de-allocating the image
70 /// buffer until we have a new report.
71 osvr::clientkit::ImagingReportOpenCV lastReport;
72
73 // Register the imaging callback.
74 osvr::clientkit::registerImagingCallback(camera, &imagingCallback,
75 &lastReport);
76
77 // Output instructions to the console.
78 std::cout << std::endl << windowNameAndInstructions << std::endl;
79
80 // Pretend that this is your application's mainloop.
81 // We're using a simple OpenCV "highgui" loop here.
82 cv::namedWindow(windowNameAndInstructions);
83 while (1) {
84 context.update();
85 char key = static_cast<char>(cv::waitKey(1)); // wait 1 ms for a key
86 if ('q' == key || 'Q' == key || 27 /*esc*/ == key) {
87 break;
88 }
89 }
90
91 std::cout << "Library shut down, exiting." << std::endl;
92 return 0;
93}

Callers

nothing calls this directly

Calls 3

registerImagingCallbackFunction · 0.85
getInterfaceMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected