fix the record's bug

This commit is contained in:
KalmanSLightech 2018-07-23 20:28:15 +08:00
parent d4547c5525
commit 900c44179d
3 changed files with 8 additions and 4 deletions

View File

@ -120,8 +120,9 @@ int main(int argc, char *argv[]) {
right_data.frame->data());
cv::Mat img;
cv::cvtColor(left_img, left_img, cv::COLOR_YUV2BGR_YUY2);
cv::cvtColor(right_img, right_img, cv::COLOR_YUV2BGR_YUY2);
cv::hconcat(left_img, right_img, img);
cv::cvtColor(img, img, cv::COLOR_YUV2BGR_YUY2);
cv::imshow("frame", img);
char key = static_cast<char>(cv::waitKey(1));

View File

@ -70,7 +70,8 @@ void Dataset::SaveStreamData(
ss << writer->outdir << OS_SEP << std::dec
<< std::setw(IMAGE_FILENAME_WIDTH) << std::setfill('0') << seq << ".png";
cv::Mat img(
data.frame->height(), data.frame->width(), CV_8UC1, data.frame->data());
data.frame->height(), data.frame->width(), CV_8UC2, data.frame->data());
cv::cvtColor(img, img, cv::COLOR_YUV2BGR_YUY2);
cv::imwrite(ss.str(), img);
}
++stream_counts_[stream];

View File

@ -80,12 +80,14 @@ int main(int argc, char *argv[]) {
auto &&left_frame = left_datas.back().frame;
auto &&right_frame = right_datas.back().frame;
cv::Mat left_img(
left_frame->height(), left_frame->width(), CV_8UC1, left_frame->data());
left_frame->height(), left_frame->width(), CV_8UC2, left_frame->data());
cv::Mat right_img(
right_frame->height(), right_frame->width(), CV_8UC1,
right_frame->height(), right_frame->width(), CV_8UC2,
right_frame->data());
cv::Mat img;
cv::cvtColor(left_img, left_img, cv::COLOR_YUV2BGR_YUY2);
cv::cvtColor(right_img, right_img, cv::COLOR_YUV2BGR_YUY2);
cv::hconcat(left_img, right_img, img);
cv::imshow("frame", img);