Merge branch 'release/v2.5.0' of http://gitlab.mynt.com/mynteye/mynt-eye-s-sdk into release/v2.5.0

This commit is contained in:
Messier 2019-10-23 13:42:25 +08:00
commit 7f77847fb7
4 changed files with 68 additions and 51 deletions

View File

@ -195,14 +195,14 @@ enum class Option : std::uint8_t {
* Max exposure time, valid if auto-exposure * Max exposure time, valid if auto-exposure
* <p> * <p>
* range of standard 1: [0,240], default: 240<br> * range of standard 1: [0,240], default: 240<br>
* range of standard 2: [0,1000], default: 333 * range of standard 2: [0,655], default: 333
* </p> * </p>
*/ */
MAX_EXPOSURE_TIME, MAX_EXPOSURE_TIME,
/** /**
* min exposure time, valid if auto-exposure * min exposure time, valid if auto-exposure
* <p> * <p>
* range: [0,1000], default: 0<br> * range: [0,655], default: 0<br>
* </p> * </p>
*/ */
MIN_EXPOSURE_TIME, MIN_EXPOSURE_TIME,
@ -576,7 +576,7 @@ struct MYNTEYE_API ImuIntrinsics {
double scale[3][3]; double scale[3][3];
/** Assembly error [3][3] */ /** Assembly error [3][3] */
double assembly[3][3]; double assembly[3][3];
/* Zero-drift: X, Y, Z */ /** Zero-drift: X, Y, Z */
double drift[3]; double drift[3];
/** Noise density variances */ /** Noise density variances */
double noise[3]; double noise[3];

View File

@ -32,6 +32,8 @@ int main(int argc, char *argv[]) {
Model model = api->GetModel(); Model model = api->GetModel();
api->Start(Source::VIDEO_STREAMING);
// Set auto exposure options fo s1030 // Set auto exposure options fo s1030
if (model == Model::STANDARD) { if (model == Model::STANDARD) {
// auto-exposure: 0 // auto-exposure: 0
@ -83,8 +85,6 @@ int main(int argc, char *argv[]) {
<< api->GetOptionValue(Option::MIN_EXPOSURE_TIME); << api->GetOptionValue(Option::MIN_EXPOSURE_TIME);
} }
api->Start(Source::VIDEO_STREAMING);
CVPainter painter(frame_rate); CVPainter painter(frame_rate);
cv::namedWindow("frame"); cv::namedWindow("frame");

View File

@ -122,7 +122,7 @@ void Dataset::SaveStreamData(
std::stringstream ss; std::stringstream ss;
ss << writer->outdir << MYNTEYE_OS_SEP << std::dec ss << writer->outdir << MYNTEYE_OS_SEP << std::dec
<< std::setw(IMAGE_FILENAME_WIDTH) << std::setfill('0') << seq << ".png"; << std::setw(IMAGE_FILENAME_WIDTH) << std::setfill('0') << seq << ".png";
cv::imwrite(ss.str(), data.frame); cv::imwrite(ss.str(), data.frame);
} }
++stream_counts_[stream]; ++stream_counts_[stream];
} }
@ -137,8 +137,8 @@ void Dataset::SaveMotionData(const api::MotionData &data) {
<< data.imu->gyro[0] << ", " << data.imu->gyro[1] << ", " << data.imu->gyro[0] << ", " << data.imu->gyro[1] << ", "
<< data.imu->gyro[2] << ", " << data.imu->temperature << data.imu->gyro[2] << ", " << data.imu->temperature
<< std::endl; << std::endl;
++motion_count_;
motion_count_++;
/* /*
if(motion_count_ != seq) { if(motion_count_ != seq) {
LOG(INFO) << "motion_count_ != seq !" << " motion_count_: " << motion_count_ LOG(INFO) << "motion_count_ != seq !" << " motion_count_: " << motion_count_
@ -166,6 +166,15 @@ Dataset::writer_t Dataset::GetStreamWriter(const Stream &stream) {
case Stream::DISPARITY: { case Stream::DISPARITY: {
writer->outdir = outdir_ + MYNTEYE_OS_SEP "disparity"; writer->outdir = outdir_ + MYNTEYE_OS_SEP "disparity";
} break; } break;
case Stream::RIGHT_RECTIFIED: {
writer->outdir = outdir_ + MYNTEYE_OS_SEP "right_rect";
} break;
case Stream::LEFT_RECTIFIED: {
writer->outdir = outdir_ + MYNTEYE_OS_SEP "left_rect";
} break;
case Stream::DISPARITY_NORMALIZED: {
writer->outdir = outdir_ + MYNTEYE_OS_SEP "disparity_norm";
} break;
default: default:
LOG(FATAL) << "Unsupported stream: " << stream; LOG(FATAL) << "Unsupported stream: " << stream;
} }

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();
@ -68,60 +68,68 @@ int main(int argc, char *argv[]) {
auto &&left_datas = api->GetStreamDatas(Stream::LEFT); auto &&left_datas = api->GetStreamDatas(Stream::LEFT);
auto &&right_datas = api->GetStreamDatas(Stream::RIGHT); auto &&right_datas = api->GetStreamDatas(Stream::RIGHT);
auto &&depth_datas = api->GetStreamDatas(Stream::DEPTH); auto &&depth_data = api->GetStreamData(Stream::DEPTH);
auto &&disparity_datas = api->GetStreamDatas(Stream::DISPARITY); auto &&disparity_data = api->GetStreamData(Stream::DISPARITY);
img_count += left_datas.size(); img_count += left_datas.size();
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 && right_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 (right_frame->data() && left_frame->data()) {
left_frame->data()); if (left_frame->format() == Format::GREY) {
cv::Mat right_img( cv::Mat left_img(
right_frame->height(), right_frame->width(), CV_8UC1, left_frame->height(), left_frame->width(), CV_8UC1,
right_frame->data()); left_frame->data());
cv::hconcat(left_img, right_img, img); cv::Mat right_img(
} else if (left_frame->format() == Format::YUYV) { right_frame->height(), right_frame->width(), CV_8UC1,
cv::Mat left_img( right_frame->data());
left_frame->height(), left_frame->width(), CV_8UC2, cv::hconcat(left_img, right_img, img);
left_frame->data()); } else if (left_frame->format() == Format::YUYV) {
cv::Mat right_img( cv::Mat left_img(
right_frame->height(), right_frame->width(), CV_8UC2, left_frame->height(), left_frame->width(), CV_8UC2,
right_frame->data()); left_frame->data());
cv::cvtColor(left_img, left_img, cv::COLOR_YUV2BGR_YUY2); cv::Mat right_img(
cv::cvtColor(right_img, right_img, cv::COLOR_YUV2BGR_YUY2); right_frame->height(), right_frame->width(), CV_8UC2,
cv::hconcat(left_img, right_img, img); right_frame->data());
} else if (left_frame->format() == Format::BGR888) { cv::cvtColor(left_img, left_img, cv::COLOR_YUV2BGR_YUY2);
cv::Mat left_img( cv::cvtColor(right_img, right_img, cv::COLOR_YUV2BGR_YUY2);
left_frame->height(), left_frame->width(), CV_8UC3, cv::hconcat(left_img, right_img, img);
left_frame->data()); } else if (left_frame->format() == Format::BGR888) {
cv::Mat right_img( cv::Mat left_img(
right_frame->height(), right_frame->width(), CV_8UC3, left_frame->height(), left_frame->width(), CV_8UC3,
right_frame->data()); left_frame->data());
cv::hconcat(left_img, right_img, img); cv::Mat right_img(
} else { right_frame->height(), right_frame->width(), CV_8UC3,
return -1; right_frame->data());
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
for (auto &&left : left_datas) { for (auto &&left : left_datas) {
dataset.SaveStreamData(Stream::LEFT, left); dataset.SaveStreamData(Stream::LEFT, left);
} }
for (auto &&right : right_datas) { // save Stream::RIGHT
dataset.SaveStreamData(Stream::RIGHT, right); // for (auto &&right : right_datas) {
// dataset.SaveStreamData(Stream::RIGHT, right);
// }
// save Stream::DEPTH
if (!depth_data.frame.empty()) {
dataset.SaveStreamData(Stream::DEPTH, depth_data);
} }
for (auto &&depth : depth_datas) {
dataset.SaveStreamData(Stream::DEPTH, depth); // save Stream::DISPARITY
} if (!disparity_data.frame.empty()) {
for (auto &&disparity : disparity_datas) { dataset.SaveStreamData(Stream::DISPARITY, disparity_data);
dataset.SaveStreamData(Stream::DISPARITY, disparity);
} }
for (auto &&motion : motion_datas) { for (auto &&motion : motion_datas) {