43 lines
943 B
C++
43 lines
943 B
C++
#include <opencv2/highgui/highgui.hpp>
|
|
|
|
#include <glog/logging.h>
|
|
|
|
#include "mynteye/api.h"
|
|
|
|
MYNTEYE_USE_NAMESPACE
|
|
|
|
int main(int argc, char *argv[]) {
|
|
auto &&api = API::Create(argc, argv);
|
|
|
|
api->EnableStreamData(Stream::DEPTH);
|
|
|
|
api->Start(Source::VIDEO_STREAMING);
|
|
|
|
cv::namedWindow("frame");
|
|
cv::namedWindow("depth");
|
|
|
|
while (true) {
|
|
api->WaitForStreams();
|
|
|
|
auto &&left_data = api->GetStreamData(Stream::LEFT);
|
|
auto &&right_data = api->GetStreamData(Stream::RIGHT);
|
|
|
|
cv::Mat img;
|
|
cv::hconcat(left_data.frame, right_data.frame, img);
|
|
cv::imshow("frame", img);
|
|
|
|
auto &&depth_data = api->GetStreamData(Stream::DEPTH);
|
|
if (!depth_data.frame.empty()) {
|
|
cv::imshow("depth", depth_data.frame); // CV_16UC1
|
|
}
|
|
|
|
char key = static_cast<char>(cv::waitKey(1));
|
|
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
|
|
break;
|
|
}
|
|
}
|
|
|
|
api->Stop(Source::VIDEO_STREAMING);
|
|
return 0;
|
|
}
|