fix(sample): nullptr check.
This commit is contained in:
parent
165efd7c79
commit
7e4645f8a9
|
@ -78,36 +78,38 @@ int main(int argc, char *argv[]) {
|
||||||
if (left_datas.size() > 0 && right_datas.size() > 0) {
|
if (left_datas.size() > 0 && right_datas.size() > 0) {
|
||||||
auto &&left_frame = left_datas.back().frame_raw;
|
auto &&left_frame = left_datas.back().frame_raw;
|
||||||
auto &&right_frame = right_datas.back().frame_raw;
|
auto &&right_frame = right_datas.back().frame_raw;
|
||||||
if (left_frame->format() == Format::GREY) {
|
if (right_frame->data() && left_frame->data()) {
|
||||||
cv::Mat left_img(
|
if (left_frame->format() == Format::GREY) {
|
||||||
left_frame->height(), left_frame->width(), CV_8UC1,
|
cv::Mat left_img(
|
||||||
left_frame->data());
|
left_frame->height(), left_frame->width(), CV_8UC1,
|
||||||
cv::Mat right_img(
|
left_frame->data());
|
||||||
right_frame->height(), right_frame->width(), CV_8UC1,
|
cv::Mat right_img(
|
||||||
right_frame->data());
|
right_frame->height(), right_frame->width(), CV_8UC1,
|
||||||
cv::hconcat(left_img, right_img, img);
|
right_frame->data());
|
||||||
} else if (left_frame->format() == Format::YUYV) {
|
cv::hconcat(left_img, right_img, img);
|
||||||
cv::Mat left_img(
|
} else if (left_frame->format() == Format::YUYV) {
|
||||||
left_frame->height(), left_frame->width(), CV_8UC2,
|
cv::Mat left_img(
|
||||||
left_frame->data());
|
left_frame->height(), left_frame->width(), CV_8UC2,
|
||||||
cv::Mat right_img(
|
left_frame->data());
|
||||||
right_frame->height(), right_frame->width(), CV_8UC2,
|
cv::Mat right_img(
|
||||||
right_frame->data());
|
right_frame->height(), right_frame->width(), CV_8UC2,
|
||||||
cv::cvtColor(left_img, left_img, cv::COLOR_YUV2BGR_YUY2);
|
right_frame->data());
|
||||||
cv::cvtColor(right_img, right_img, cv::COLOR_YUV2BGR_YUY2);
|
cv::cvtColor(left_img, left_img, cv::COLOR_YUV2BGR_YUY2);
|
||||||
cv::hconcat(left_img, right_img, img);
|
cv::cvtColor(right_img, right_img, cv::COLOR_YUV2BGR_YUY2);
|
||||||
} else if (left_frame->format() == Format::BGR888) {
|
cv::hconcat(left_img, right_img, img);
|
||||||
cv::Mat left_img(
|
} else if (left_frame->format() == Format::BGR888) {
|
||||||
left_frame->height(), left_frame->width(), CV_8UC3,
|
cv::Mat left_img(
|
||||||
left_frame->data());
|
left_frame->height(), left_frame->width(), CV_8UC3,
|
||||||
cv::Mat right_img(
|
left_frame->data());
|
||||||
right_frame->height(), right_frame->width(), CV_8UC3,
|
cv::Mat right_img(
|
||||||
right_frame->data());
|
right_frame->height(), right_frame->width(), CV_8UC3,
|
||||||
cv::hconcat(left_img, right_img, img);
|
right_frame->data());
|
||||||
} else {
|
cv::hconcat(left_img, right_img, img);
|
||||||
return -1;
|
} 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user