In this paper, we employ the line feature, which is robust to visual changes, in the visual inertial odometry algorithm to enable robust localization in the indoor environment. The lines are classified into four types, and the novel optical flow-based line tracker is designed to increase computational efficiency and accuracy of line extraction and matching.