Height restriction bars (HRBs) are diverse in appearance and widely distributed on roads, which can effectively protect bridges and other structures from damage. On the other hand, these HRBs also bring safety issues and economic losses. Therefore, it is of great practical significance to detect and warn HRBs in advance. The highway scene environment is extremely complex, the shapes of HRBs are usually non-standard, and the vehicle driving tracks are diverse, which bring great difficulties and challenges to the detection of HRBs. Existing methods for HRBs measurement and warning have several limitations, such as the high equipment costs and insufficient accuracy for real-time requirements. To overcome these limitations, this paper proposes a novel and automatic measuring algorithm for HRBs based on binocular camera. In this algorithm, HRBs are detected by YOLOX and the disparity data is filtered using a multi-step and multi-scale method. Based on the detected HRB, a robust algorithm is proposed to measure the distance and height, which can effectively prevent the accidents caused by HRB. In the proposed algorithm the Kalman filtering and RANSAC are used to improve the measurement accuracy. A new HRB dataset named HRB23 is constructed. The effectiveness and performance of the proposed algorithms are demonstrated on a set of real-life and virtual HRB scenarios.