fix save img params bug
This commit is contained in:
parent
6feeb49d62
commit
13e9a89b59
|
@ -21,7 +21,8 @@ int main(int argc, char *argv[]) {
|
||||||
auto &&api = API::Create(argc, argv);
|
auto &&api = API::Create(argc, argv);
|
||||||
if (!api)
|
if (!api)
|
||||||
return 1;
|
return 1;
|
||||||
|
api->SetStreamRequest(
|
||||||
|
Resolution::RES_2560x800, Format::BGR888, FrameRate::RATE_30_FPS);
|
||||||
LOG(INFO) << "Intrinsics left: {" << api->GetIntrinsics(Stream::LEFT) << "}";
|
LOG(INFO) << "Intrinsics left: {" << api->GetIntrinsics(Stream::LEFT) << "}";
|
||||||
LOG(INFO) << "Intrinsics right: {" << api->GetIntrinsics(Stream::RIGHT)
|
LOG(INFO) << "Intrinsics right: {" << api->GetIntrinsics(Stream::RIGHT)
|
||||||
<< "}";
|
<< "}";
|
||||||
|
|
|
@ -663,7 +663,8 @@ bool Channels::GetFiles(
|
||||||
img_params->ok = file_size > 0;
|
img_params->ok = file_size > 0;
|
||||||
if (img_params->ok) {
|
if (img_params->ok) {
|
||||||
CheckSpecVersion(spec_ver);
|
CheckSpecVersion(spec_ver);
|
||||||
CHECK_EQ(from_data(img_params, data + i, spec_ver), file_size);
|
from_data(img_params, data + i, spec_ver);
|
||||||
|
// CHECK_EQ(from_data(img_params, data + i, spec_ver), file_size);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case FID_IMU_PARAMS: {
|
case FID_IMU_PARAMS: {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
%YAML:1.0
|
%YAML:1.0
|
||||||
---
|
---
|
||||||
|
version: 1.1
|
||||||
in_left_map:
|
in_left_map:
|
||||||
-
|
-
|
||||||
width: 640
|
width: 640
|
||||||
|
|
|
@ -130,6 +130,16 @@ cv::FileStorage &operator<<(
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cv::FileStorage &operator<<(
|
||||||
|
cv::FileStorage &fs, const std::map<Resolution, Intrinsics> &mapIn) {
|
||||||
|
fs << "[";
|
||||||
|
std::map<Resolution, Intrinsics>::const_iterator it;
|
||||||
|
for (it = mapIn.begin(); it != mapIn.end(); it++)
|
||||||
|
fs << (*it).second;
|
||||||
|
fs << "]";
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
|
|
||||||
cv::FileStorage &operator<<(cv::FileStorage &fs, const ImuIntrinsics &in) {
|
cv::FileStorage &operator<<(cv::FileStorage &fs, const ImuIntrinsics &in) {
|
||||||
std::vector<double> scales;
|
std::vector<double> scales;
|
||||||
for (std::size_t i = 0; i < 3; i++) {
|
for (std::size_t i = 0; i < 3; i++) {
|
||||||
|
@ -189,26 +199,9 @@ bool DeviceWriter::SaveImgParams(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Intrinsics> v_left;
|
if (params.in_left_map.size() == params.in_right_map.size()) {
|
||||||
std::vector<Intrinsics> v_right;
|
fs << "in_left_map" << params.in_left_map << "in_right_map"
|
||||||
std::map<Resolution, Intrinsics>::const_iterator it;
|
<< params.in_right_map << "ex_left_to_right" << params.ex_left_to_right;
|
||||||
|
|
||||||
for (it = params.in_left_map.begin(); it != params.in_left_map.end(); it++)
|
|
||||||
v_left.push_back((*it).second);
|
|
||||||
|
|
||||||
for (it = params.in_right_map.begin(); it != params.in_right_map.end(); it++)
|
|
||||||
v_right.push_back((*it).second);
|
|
||||||
|
|
||||||
if (v_left.size() == v_right.size() && v_left.size() > 0) {
|
|
||||||
fs << "in_left_map";
|
|
||||||
for (unsigned int i = 0; i < v_left.size(); i++)
|
|
||||||
fs << v_left[i];
|
|
||||||
|
|
||||||
fs << "in_right_map";
|
|
||||||
for (unsigned int i = 0; i < v_right.size(); i++)
|
|
||||||
fs << v_right[i];
|
|
||||||
|
|
||||||
fs << "ex_left_to_right" << params.ex_left_to_right;
|
|
||||||
fs.release();
|
fs.release();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -351,6 +344,7 @@ DeviceWriter::img_params_t DeviceWriter::LoadImgParams(
|
||||||
img_params_t params;
|
img_params_t params;
|
||||||
if (fs["version"].isNone()) {
|
if (fs["version"].isNone()) {
|
||||||
if (fs["in_left"].isNone()) {
|
if (fs["in_left"].isNone()) {
|
||||||
|
LOG(INFO) << "static_cast<double>(fs[version]) == 0.1";
|
||||||
std::uint16_t w = 752;
|
std::uint16_t w = 752;
|
||||||
std::uint16_t h = 480;
|
std::uint16_t h = 480;
|
||||||
std::uint8_t m = 0;
|
std::uint8_t m = 0;
|
||||||
|
@ -381,15 +375,17 @@ DeviceWriter::img_params_t DeviceWriter::LoadImgParams(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (static_cast<double>(fs["version"]) == 1.0) {
|
if (static_cast<double>(fs["version"]) == 1.0) {
|
||||||
|
LOG(INFO) << "static_cast<double>(fs[version]) == 1.0";
|
||||||
fs["in_left_map"][0] >> params.in_left_map[Resolution::RES_752x480];
|
fs["in_left_map"][0] >> params.in_left_map[Resolution::RES_752x480];
|
||||||
fs["in_right_map"][0] >> params.in_right_map[Resolution::RES_752x480];
|
fs["in_right_map"][0] >> params.in_right_map[Resolution::RES_752x480];
|
||||||
fs["ex_left_to_right"] >> params.ex_left_to_right;
|
fs["ex_left_to_right"] >> params.ex_left_to_right;
|
||||||
}
|
}
|
||||||
if (static_cast<double>(fs["version"]) == 1.1) {
|
if (static_cast<double>(fs["version"]) == 1.1) {
|
||||||
|
LOG(INFO) << "static_cast<double>(fs[version]) == 1.1";
|
||||||
fs["in_left_map"][0] >> params.in_left_map[Resolution::RES_1280x400];
|
fs["in_left_map"][0] >> params.in_left_map[Resolution::RES_1280x400];
|
||||||
fs["in_left_map"][1] >> params.in_left_map[Resolution::RES_2560x800];
|
fs["in_left_map"][1] >> params.in_left_map[Resolution::RES_2560x800];
|
||||||
fs["in_right_map"][0] >> params.in_right_map[Resolution::RES_1280x400];
|
fs["in_right_map"][0] >> params.in_right_map[Resolution::RES_1280x400];
|
||||||
fs["in_right_map"][1] >> params.in_left_map[Resolution::RES_2560x800];
|
fs["in_right_map"][1] >> params.in_right_map[Resolution::RES_2560x800];
|
||||||
fs["ex_left_to_right"] >> params.ex_left_to_right;
|
fs["ex_left_to_right"] >> params.ex_left_to_right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user