| 62 | lastReport = report; |
| 63 | } |
| 64 | int 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 | } |
nothing calls this directly
no test coverage detected