~estraw/visual-odometry

2deb96294118675761fabc6b1e979862f9be6a50 — Evan Straw 3 months ago 811ef38
Improve visualization
2 files changed, 13 insertions(+), 10 deletions(-)

M src/visual_odometry.py
M src/visual_odometry_demo.py
M src/visual_odometry.py => src/visual_odometry.py +4 -2
@@ 131,8 131,10 @@ class VisualOdometry:
                                                 self.__time_matches[1],
                                                 alpha, prev_color,
                                                 cur_color, line_color)
        out_frame = cv2.vconcat([out_frame_left, out_frame_right])
        return out_frame
        if (out_frame_left.shape[1] / float(out_frame_left.shape[0])) > 2:
            return cv2.vconcat([out_frame_left, out_frame_right])
        else:
            return cv2.hconcat([out_frame_left, out_frame_right])

    @staticmethod
    def formatRT(rvec, tvec):

M src/visual_odometry_demo.py => src/visual_odometry_demo.py +9 -8
@@ 55,16 55,17 @@ def drawInfo(vo, width, fps, rvec, tvec, rvec_real=None, tvec_real=None):

    info_bar = np.zeros((bar_height, out_frame.shape[1], 3), np.uint8)
    cv2.putText(info_bar, ("FPS: %d" % fps),
                (0, int(1.5 * f_height)),
                (0, int((bar_height - f_height) / 2)+f_height),
                cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255))

    msgs = vo.formatRT(rvec, tvec).split("\t", 1)
    cv2.putText(info_bar, msgs[0],
                (200, f_height_small),
                cv2.FONT_HERSHEY_PLAIN, 1.5, c_grn)
    cv2.putText(info_bar, msgs[1],
                (850, f_height_small),
                cv2.FONT_HERSHEY_PLAIN, 1.5, c_blu)
    if rvec is not None and tvec is not None:
        msgs = vo.formatRT(rvec, tvec).split("\t", 1)
        cv2.putText(info_bar, msgs[0],
                    (200, f_height_small),
                    cv2.FONT_HERSHEY_PLAIN, 1.5, c_grn)
        cv2.putText(info_bar, msgs[1],
                    (850, f_height_small),
                    cv2.FONT_HERSHEY_PLAIN, 1.5, c_blu)
    if rvec_real is not None and tvec_real is not None:
        cv2.putText(info_bar, "Err:",
                    (145, int(2 * f_height_small + 5)),