Fix t as right to left
This commit is contained in:
parent
087ef28da1
commit
54165b1acb
|
@ -25,8 +25,8 @@ int main(int argc, char *argv[]) {
|
|||
LOG(INFO) << "Intrinsics left: {" << api->GetIntrinsics(Stream::LEFT) << "}";
|
||||
LOG(INFO) << "Intrinsics right: {" << api->GetIntrinsics(Stream::RIGHT)
|
||||
<< "}";
|
||||
LOG(INFO) << "Extrinsics left to right: {"
|
||||
<< api->GetExtrinsics(Stream::LEFT, Stream::RIGHT) << "}";
|
||||
LOG(INFO) << "Extrinsics right to left: {"
|
||||
<< api->GetExtrinsics(Stream::RIGHT, Stream::LEFT) << "}";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -213,11 +213,11 @@ std::vector<std::string> get_plugin_paths() {
|
|||
API::API(std::shared_ptr<Device> device) : device_(device) {
|
||||
VLOG(2) << __func__;
|
||||
if (std::dynamic_pointer_cast<StandardDevice>(device_) != nullptr) {
|
||||
bool in_l_ok, in_r_ok, ex_l2r_ok;
|
||||
bool in_l_ok, in_r_ok, ex_r2l_ok;
|
||||
device_->GetIntrinsics(Stream::LEFT, &in_l_ok);
|
||||
device_->GetIntrinsics(Stream::RIGHT, &in_r_ok);
|
||||
device_->GetExtrinsics(Stream::LEFT, Stream::RIGHT, &ex_l2r_ok);
|
||||
if (!in_l_ok || !in_r_ok || !ex_l2r_ok) {
|
||||
device_->GetExtrinsics(Stream::RIGHT, Stream::LEFT, &ex_r2l_ok);
|
||||
if (!in_l_ok || !in_r_ok || !ex_r2l_ok) {
|
||||
#if defined(WITH_DEVICE_INFO_REQUIRED)
|
||||
LOG(FATAL)
|
||||
#else
|
||||
|
|
|
@ -30,7 +30,7 @@ RectifyProcessor::RectifyProcessor(
|
|||
VLOG(2) << __func__ << ": proc_period=" << proc_period;
|
||||
InitParams(
|
||||
device->GetIntrinsics(Stream::LEFT), device->GetIntrinsics(Stream::RIGHT),
|
||||
device->GetExtrinsics(Stream::LEFT, Stream::RIGHT));
|
||||
device->GetExtrinsics(Stream::RIGHT, Stream::LEFT));
|
||||
}
|
||||
|
||||
RectifyProcessor::~RectifyProcessor() {
|
||||
|
@ -56,7 +56,7 @@ bool RectifyProcessor::OnProcess(
|
|||
}
|
||||
|
||||
void RectifyProcessor::InitParams(
|
||||
Intrinsics in_left, Intrinsics in_right, Extrinsics ex_left_to_right) {
|
||||
Intrinsics in_left, Intrinsics in_right, Extrinsics ex_right_to_left) {
|
||||
cv::Size size{in_left.width, in_left.height};
|
||||
|
||||
cv::Mat M1 =
|
||||
|
@ -68,12 +68,12 @@ void RectifyProcessor::InitParams(
|
|||
cv::Mat D1(1, 5, CV_64F, in_left.coeffs);
|
||||
cv::Mat D2(1, 5, CV_64F, in_right.coeffs);
|
||||
cv::Mat R =
|
||||
(cv::Mat_<double>(3, 3) << ex_left_to_right.rotation[0][0],
|
||||
ex_left_to_right.rotation[0][1], ex_left_to_right.rotation[0][2],
|
||||
ex_left_to_right.rotation[1][0], ex_left_to_right.rotation[1][1],
|
||||
ex_left_to_right.rotation[1][2], ex_left_to_right.rotation[2][0],
|
||||
ex_left_to_right.rotation[2][1], ex_left_to_right.rotation[2][2]);
|
||||
cv::Mat T(3, 1, CV_64F, ex_left_to_right.translation);
|
||||
(cv::Mat_<double>(3, 3) << ex_right_to_left.rotation[0][0],
|
||||
ex_right_to_left.rotation[0][1], ex_right_to_left.rotation[0][2],
|
||||
ex_right_to_left.rotation[1][0], ex_right_to_left.rotation[1][1],
|
||||
ex_right_to_left.rotation[1][2], ex_right_to_left.rotation[2][0],
|
||||
ex_right_to_left.rotation[2][1], ex_right_to_left.rotation[2][2]);
|
||||
cv::Mat T(3, 1, CV_64F, ex_right_to_left.translation);
|
||||
|
||||
VLOG(2) << "InitParams size: " << size;
|
||||
VLOG(2) << "M1: " << M1;
|
||||
|
|
|
@ -47,7 +47,7 @@ class RectifyProcessor : public Processor {
|
|||
|
||||
private:
|
||||
void InitParams(
|
||||
Intrinsics in_left, Intrinsics in_right, Extrinsics ex_left_to_right);
|
||||
Intrinsics in_left, Intrinsics in_right, Extrinsics ex_right_to_left);
|
||||
};
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
|
|
@ -565,11 +565,11 @@ void Device::ReadAllInfos() {
|
|||
if (img_params.ok) {
|
||||
SetIntrinsics(Stream::LEFT, img_params.in_left);
|
||||
SetIntrinsics(Stream::RIGHT, img_params.in_right);
|
||||
SetExtrinsics(Stream::LEFT, Stream::RIGHT, img_params.ex_left_to_right);
|
||||
SetExtrinsics(Stream::RIGHT, Stream::LEFT, img_params.ex_right_to_left);
|
||||
VLOG(2) << "Intrinsics left: {" << GetIntrinsics(Stream::LEFT) << "}";
|
||||
VLOG(2) << "Intrinsics right: {" << GetIntrinsics(Stream::RIGHT) << "}";
|
||||
VLOG(2) << "Extrinsics left to right: {"
|
||||
<< GetExtrinsics(Stream::LEFT, Stream::RIGHT) << "}";
|
||||
VLOG(2) << "Extrinsics right to left: {"
|
||||
<< GetExtrinsics(Stream::RIGHT, Stream::LEFT) << "}";
|
||||
} else {
|
||||
LOG(WARNING) << "Intrinsics & extrinsics not exist";
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ std::size_t from_data(
|
|||
std::size_t i = 0;
|
||||
i += from_data(&img_params->in_left, data + i, spec_version);
|
||||
i += from_data(&img_params->in_right, data + i, spec_version);
|
||||
i += from_data(&img_params->ex_left_to_right, data + i, spec_version);
|
||||
i += from_data(&img_params->ex_right_to_left, data + i, spec_version);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -787,7 +787,7 @@ std::size_t to_data(
|
|||
std::size_t i = 3; // skip id, size
|
||||
i += to_data(&img_params->in_left, data + i, spec_version);
|
||||
i += to_data(&img_params->in_right, data + i, spec_version);
|
||||
i += to_data(&img_params->ex_left_to_right, data + i, spec_version);
|
||||
i += to_data(&img_params->ex_right_to_left, data + i, spec_version);
|
||||
// others
|
||||
std::size_t size = i - 3;
|
||||
data[0] = Channels::FID_IMG_PARAMS;
|
||||
|
|
|
@ -72,7 +72,7 @@ class MYNTEYE_API Channels {
|
|||
bool ok;
|
||||
Intrinsics in_left;
|
||||
Intrinsics in_right;
|
||||
Extrinsics ex_left_to_right;
|
||||
Extrinsics ex_right_to_left;
|
||||
} img_params_t;
|
||||
|
||||
typedef struct ImuParams {
|
||||
|
|
|
@ -72,7 +72,7 @@ bool DeviceWriter::WriteImgParams(const img_params_t ¶ms) {
|
|||
LOG(INFO) << "Write img params success";
|
||||
LOG(INFO) << "Intrinsics left: {" << params.in_left << "}";
|
||||
LOG(INFO) << "Intrinsics right: {" << params.in_right << "}";
|
||||
LOG(INFO) << "Extrinsics left to right: {" << params.ex_left_to_right
|
||||
LOG(INFO) << "Extrinsics right to left: {" << params.ex_right_to_left
|
||||
<< "}";
|
||||
return true;
|
||||
} else {
|
||||
|
@ -185,8 +185,8 @@ bool DeviceWriter::SaveImgParams(
|
|||
return false;
|
||||
}
|
||||
fs << "in_left" << std::vector<Intrinsics>{params.in_left} << "in_right"
|
||||
<< std::vector<Intrinsics>{params.in_right} << "ex_left_to_right"
|
||||
<< params.ex_left_to_right;
|
||||
<< std::vector<Intrinsics>{params.in_right} << "ex_right_to_left"
|
||||
<< params.ex_right_to_left;
|
||||
fs.release();
|
||||
return true;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ void DeviceWriter::SaveAllInfos(const std::string &dir) {
|
|||
SaveImgParams(
|
||||
{false, device_->GetIntrinsics(Stream::LEFT),
|
||||
device_->GetIntrinsics(Stream::RIGHT),
|
||||
device_->GetExtrinsics(Stream::LEFT, Stream::RIGHT)},
|
||||
device_->GetExtrinsics(Stream::RIGHT, Stream::LEFT)},
|
||||
dir + OS_SEP "img.params");
|
||||
auto &&m_in = device_->GetMotionIntrinsics();
|
||||
SaveImuParams(
|
||||
|
@ -348,11 +348,11 @@ DeviceWriter::img_params_t DeviceWriter::LoadImgParams(
|
|||
|
||||
to_intrinsics(w, h, m, M1, D1, ¶ms.in_left);
|
||||
to_intrinsics(w, h, m, M2, D2, ¶ms.in_right);
|
||||
to_extrinsics(R, T, ¶ms.ex_left_to_right);
|
||||
to_extrinsics(R, T, ¶ms.ex_right_to_left);
|
||||
} else {
|
||||
fs["in_left"][0] >> params.in_left;
|
||||
fs["in_right"][0] >> params.in_right;
|
||||
fs["ex_left_to_right"] >> params.ex_left_to_right;
|
||||
fs["ex_right_to_left"] >> params.ex_right_to_left;
|
||||
}
|
||||
|
||||
fs.release();
|
||||
|
|
Loading…
Reference in New Issue
Block a user