From 06bd532caa3017fd2e2e547461958b1aec460a6a Mon Sep 17 00:00:00 2001 From: Ivan Date: Sun, 17 Apr 2022 14:01:07 +0300 Subject: [PATCH] v3 --- src/vio.cpp | 115 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 48 deletions(-) diff --git a/src/vio.cpp b/src/vio.cpp index dc3032a..4fa36f2 100644 --- a/src/vio.cpp +++ b/src/vio.cpp @@ -104,7 +104,10 @@ pangolin::Var drawLineCubeBool("ui.DrawCubeLine", false, true); pangolin::Var zeroOut("ui.ZeroOut", false, true); pangolin::Var drawTexture("ui.drawTexture", true, false); pangolin::Var IfDrawOpenCVCube("ui.DrawOpenCVCube", false, true); -pangolin::Var saveRenderScale("ui.SaveRenderScale", 1.653, 1.50, 1.8); +// For the sequence 6 +//pangolin::Var saveRenderScale("ui.SaveRenderScale", 1.653, 1.50, 1.8); +// For the sequence 0, 1.68 is the right. +pangolin::Var saveRenderScale("ui.SaveRenderScale", 1.68, 1.5, 1.8); pangolin::Var saveRenderBool("ui.SaveRender", false, true); pangolin::Var showCube1("ui.Cube1", true, false); @@ -678,9 +681,13 @@ int main(int argc, char** argv) { pangolin::View& main_display = pangolin::CreateDisplay().SetBounds( 0.0, 1.0, pangolin::Attach::Pix(UI_WIDTH), 1.0); + // For the saving of the files. Use 1.68 scale save of 00 sequence. pangolin::View& img_view_display = pangolin::CreateDisplay() - .SetBounds(0.4, 1.0, 0, 0.4) + .SetBounds(0.0, 1.0, pangolin::Attach::Pix(UI_WIDTH), 1.0) .SetLayout(pangolin::LayoutEqual); +// pangolin::View& img_view_display = pangolin::CreateDisplay() +// .SetBounds(0.4, 1.0, 0.0, 0.4) +// .SetLayout(pangolin::LayoutEqual); // pangolin::View& plot_display = pangolin::CreateDisplay().SetBounds( // 0.0, 0.4, pangolin::Attach::Pix(UI_WIDTH), 1.0); @@ -764,6 +771,7 @@ int main(int argc, char** argv) { display3D.extern_draw_function = draw_scene; + // Appended. // Appended. ar_view.extern_draw_function = draw_scene_no_camera; @@ -1173,13 +1181,22 @@ void draw_scene(pangolin::View& view) { drawLinesCube(xSkew, ySkew, zSkew, 1); } // For the 6th sequence mono-kitti - if (showCube1) {drawLinesCube(-5.5, 3.5, -35.0, cubeSize);} - if (showCube2) {drawLinesCube(5.5, 3.5, -40.0, cubeSize);} - if (showCube3) {drawLinesCube(-5.5, 3.8, -95.0, cubeSize);} - if (showCube4) {drawLinesCube(5.5, 3.8, -150.0, cubeSize);} - if (showCube5) {drawLinesCube(16.0, 4.8, -324.5, cubeSize);} - if (showCube6) {drawLinesCube(32.8, 4.8, -324.5, cubeSize);} - if (showCube7) {drawLinesCube(32.5, 4.8, -345.7, cubeSize);} +// if (showCube1) {drawLinesCube(-5.5, 3.5, -35.0, cubeSize);} +// if (showCube2) {drawLinesCube(5.5, 3.5, -40.0, cubeSize);} +// if (showCube3) {drawLinesCube(-5.5, 3.8, -95.0, cubeSize);} +// if (showCube4) {drawLinesCube(5.5, 3.8, -150.0, cubeSize);} +// if (showCube5) {drawLinesCube(16.0, 4.8, -324.5, cubeSize);} +// if (showCube6) {drawLinesCube(32.8, 4.8, -324.5, cubeSize);} +// if (showCube7) {drawLinesCube(32.5, 4.8, -345.7, cubeSize);} + + // For the 1st sequence mono-kitti + if (showCube1) {drawLinesCube(0.0, 1.0, -95.0, cubeSize);} + if (showCube2) {drawLinesCube(0.0, 1.5, -35.0, cubeSize);} + if (showCube3) {drawLinesCube(5.0, 1.5, -40.0, cubeSize);} + if (showCube4) {drawLinesCube(-32.0, 1.5, -85.0, cubeSize);} + if (showCube5) {drawLinesCube(-32.0, 1.5, -95.0, cubeSize);} + if (showCube6) {drawLinesCube(-64.0, 3.0, -95.0, cubeSize);} + if (showCube7) {drawLinesCube(-64.0, 3.0, -85.0, cubeSize);} // try{ // view.Activate(T); // throw (0); @@ -1242,8 +1259,8 @@ void draw_scene(pangolin::View& view) { void draw_scene_no_camera(pangolin::View& view) { UNUSED(view); view.Activate(ar_3d_camera); -// auto T_w_i = vio_T_w_i[show_frame]; -// auto T_i_c = calib.T_i_c[0]; + auto T_w_i = vio_T_w_i[show_frame]; + auto T_i_c = calib.T_i_c[0]; //// std::cout << "Extracted T_w_i matrix: " << T_w_i.matrix() << std::endl; // If you want to translate OR to Load the constructed matrix (doesn't matter) for @@ -1275,43 +1292,6 @@ void draw_scene_no_camera(pangolin::View& view) { // axesTic[i] = -axesTic[i]; // } // } - // TODO: Can I define it outside of the loop? There's no need I guess to - // redefine the the projection matrix every time - glMatrixMode(GL_PROJECTION); - P.Load(); - - // drawLinesCube pushes the matrices, therefore, I need to define in which - // stack to push that matrices. - glMatrixMode(GL_MODELVIEW); - if (zeroOut){ - xSkew = 0; - ySkew = 0; - zSkew = 0; - } - if (drawCubeBool){ - DrawCube(cubeSize, xSkew, ySkew, zSkew); - } - if (drawLineCubeBool){ - drawLinesCube(xSkew, ySkew, zSkew, cubeSize); - } - // For the 6th sequence mono-kitti - if (showCube1) {drawLinesCube(-5.5, 0.5, -35.0, cubeSize);} - if (showCube2) {drawLinesCube(5.5, 0.5, -40.0, cubeSize);} - if (showCube3) {drawLinesCube(-5.5, 1.0, -95.0, cubeSize);} - if (showCube4) {drawLinesCube(5.5, 1.0, -150.0, cubeSize);} - if (showCube5) {drawLinesCube(16.0, 4.8, -324.5, cubeSize);} - if (showCube6) {drawLinesCube(32.8, 4.8, -324.5, cubeSize);} - if (showCube7) {drawLinesCube(32.5, 4.8, -345.7, cubeSize);} - - ar_3d_camera.Follow((T_w_i * T_i_c).matrix()); - // For the 1st sequence mono-kitti -// drawLinesCube(0.0, 1.0, -95.0, cubeSize); -// drawLinesCube(0.0, 0.5, -35.0, cubeSize); -// drawLinesCube(5.0, 0.5, -40.0, cubeSize); -// drawLinesCube(-32.0, 1.0, -85.0, cubeSize); -// drawLinesCube(-32.0, 1.5, -95.0, cubeSize); -// drawLinesCube(-64.0, 3.0, -95.0, cubeSize); -// drawLinesCube(-64.0, 3.0, -85.0, cubeSize); // std::cout << "Twi with rot before: " << T_w_i.matrix() << std::endl; // Eigen::Matrix Rot; @@ -1347,6 +1327,45 @@ void draw_scene_no_camera(pangolin::View& view) { glColor3ubv(gt_color); if (show_gt) pangolin::glDrawLineStrip(gt_t_w_i); + // TODO: Can I define it outside of the loop? There's no need I guess to + // redefine the the projection matrix every time + glMatrixMode(GL_PROJECTION); + P.Load(); + + // drawLinesCube pushes the matrices, therefore, I need to define in which + // stack to push that matrices. + glMatrixMode(GL_MODELVIEW); + if (zeroOut){ + xSkew = 0; + ySkew = 0; + zSkew = 0; + } + if (drawCubeBool){ + DrawCube(cubeSize, xSkew, ySkew, zSkew); + } + if (drawLineCubeBool){ + drawLinesCube(xSkew, ySkew, zSkew, cubeSize); + } + // For the 6th sequence mono-kitti +// if (showCube1) {drawLinesCube(-5.5, 0.5, -35.0, cubeSize);} +// if (showCube2) {drawLinesCube(5.5, 0.5, -40.0, cubeSize);} +// if (showCube3) {drawLinesCube(-5.5, 1.0, -95.0, cubeSize);} +// if (showCube4) {drawLinesCube(5.5, 1.0, -150.0, cubeSize);} +// if (showCube5) {drawLinesCube(16.0, 4.8, -324.5, cubeSize);} +// if (showCube6) {drawLinesCube(32.8, 4.8, -324.5, cubeSize);} +// if (showCube7) {drawLinesCube(32.5, 4.8, -345.7, cubeSize);} + + // For the 1st sequence mono-kitti + if (showCube1) {drawLinesCube(0.0, 1.0, -95.0, cubeSize);} + if (showCube2) {drawLinesCube(0.0, 1.5, -35.0, cubeSize);} + if (showCube3) {drawLinesCube(5.0, 1.5, -40.0, cubeSize);} + if (showCube4) {drawLinesCube(-32.0, 1.5, -85.0, cubeSize);} + if (showCube5) {drawLinesCube(-32.0, 1.5, -95.0, cubeSize);} + if (showCube6) {drawLinesCube(-64.0, 3.0, -95.0, cubeSize);} + if (showCube7) {drawLinesCube(-64.0, 3.0, -85.0, cubeSize);} + + ar_3d_camera.Follow((T_w_i * T_i_c).matrix()); + // size_t frame_id = show_frame; // int64_t t_ns = vio_dataset->get_image_timestamps()[frame_id]; // auto it = vis_map.find(t_ns);