Lane detection is crucial for autonomous driving. In this paper, we present an effective and fast lane detection algorithm. The proposed algorithm includes three novelties. First, we set a region of interest (ROI) appropriate to reduce nonessential cost of computation. Second, we determine a real midpoint between two road lines for each frame. The midpoint can be used to classify the candidates of lane marking points to right and left effectively. Finally, we use a temporal trajectory strategy to avoid the failure of lane detection, which is generally caused by shadows of bridges or neighboring vehicles. Experimental results show that the proposed algorithm can label the location of lane marking accurately and fast. It processes a frame only 16 ms and can solve the problems caused by lighting change, shadows, and vehicle occlusions.