40 lines
910 B
C++
40 lines
910 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::LEFT_RECTIFIED);
|
|
api->EnableStreamData(Stream::RIGHT_RECTIFIED);
|
|
|
|
api->Start(Source::VIDEO_STREAMING);
|
|
|
|
cv::namedWindow("frame");
|
|
|
|
while (true) {
|
|
api->WaitForStreams();
|
|
|
|
auto &&left_data = api->GetStreamData(Stream::LEFT_RECTIFIED);
|
|
auto &&right_data = api->GetStreamData(Stream::RIGHT_RECTIFIED);
|
|
|
|
if (!left_data.frame.empty() && !right_data.frame.empty()) {
|
|
cv::Mat img;
|
|
cv::hconcat(left_data.frame, right_data.frame, img);
|
|
cv::imshow("frame", img);
|
|
}
|
|
|
|
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;
|
|
}
|