fix(sample): record core error.

This commit is contained in:
TinyO 2019-10-22 16:56:54 +08:00
parent 10cae0133a
commit 58aeae6564

View File

@ -42,7 +42,7 @@ int main(int argc, char *argv[]) {
// std::uint16_t fps; // std::uint16_t fps;
// } // }
request.fps = 10; // request.fps = 10;
api->ConfigStreamRequest(request); api->ConfigStreamRequest(request);
api->EnableMotionDatas(); api->EnableMotionDatas();
@ -74,42 +74,42 @@ int main(int argc, char *argv[]) {
auto &&motion_datas = api->GetMotionDatas(); auto &&motion_datas = api->GetMotionDatas();
imu_count += motion_datas.size(); imu_count += motion_datas.size();
auto &&left_frame = left_datas.back().frame_raw;
auto &&right_frame = right_datas.back().frame_raw;
cv::Mat img; cv::Mat img;
if (left_datas.size() > 0) {
if (left_frame->format() == Format::GREY) { auto &&left_frame = left_datas.back().frame_raw;
cv::Mat left_img( auto &&right_frame = right_datas.back().frame_raw;
left_frame->height(), left_frame->width(), CV_8UC1, if (left_frame->format() == Format::GREY) {
left_frame->data()); cv::Mat left_img(
cv::Mat right_img( left_frame->height(), left_frame->width(), CV_8UC1,
right_frame->height(), right_frame->width(), CV_8UC1, left_frame->data());
right_frame->data()); cv::Mat right_img(
cv::hconcat(left_img, right_img, img); right_frame->height(), right_frame->width(), CV_8UC1,
} else if (left_frame->format() == Format::YUYV) { right_frame->data());
cv::Mat left_img( cv::hconcat(left_img, right_img, img);
left_frame->height(), left_frame->width(), CV_8UC2, } else if (left_frame->format() == Format::YUYV) {
left_frame->data()); cv::Mat left_img(
cv::Mat right_img( left_frame->height(), left_frame->width(), CV_8UC2,
right_frame->height(), right_frame->width(), CV_8UC2, left_frame->data());
right_frame->data()); cv::Mat right_img(
cv::cvtColor(left_img, left_img, cv::COLOR_YUV2BGR_YUY2); right_frame->height(), right_frame->width(), CV_8UC2,
cv::cvtColor(right_img, right_img, cv::COLOR_YUV2BGR_YUY2); right_frame->data());
cv::hconcat(left_img, right_img, img); cv::cvtColor(left_img, left_img, cv::COLOR_YUV2BGR_YUY2);
} else if (left_frame->format() == Format::BGR888) { cv::cvtColor(right_img, right_img, cv::COLOR_YUV2BGR_YUY2);
cv::Mat left_img( cv::hconcat(left_img, right_img, img);
left_frame->height(), left_frame->width(), CV_8UC3, } else if (left_frame->format() == Format::BGR888) {
left_frame->data()); cv::Mat left_img(
cv::Mat right_img( left_frame->height(), left_frame->width(), CV_8UC3,
right_frame->height(), right_frame->width(), CV_8UC3, left_frame->data());
right_frame->data()); cv::Mat right_img(
cv::hconcat(left_img, right_img, img); right_frame->height(), right_frame->width(), CV_8UC3,
} else { right_frame->data());
return -1; cv::hconcat(left_img, right_img, img);
} else {
return -1;
}
cv::imshow("frame", img);
} }
cv::imshow("frame", img);
if (img_count > 10 && imu_count > 50) { // save if (img_count > 10 && imu_count > 50) { // save
// save Stream::LEFT // save Stream::LEFT
for (auto &&left : left_datas) { for (auto &&left : left_datas) {