The sliding window algorithm
While we are making progress, the image still has some noise, meaning there are pixels that can reduce the precision. In addition, we only know where the line starts.
The solution is to focus on the area around the line – after all, there is no reason to work on the whole warped image; we could start at the bottom of the line and proceed to "follow it." This is probably one case where an image is worth a thousand words, so this is what we want to achieve:
On the upper part of Figure 3.27, each rectangle represents a window of interest. The first window on the bottom of each lane is centered on the respective peak of the histogram. Then, we need a way to "follow the line." The width of each window is dependent on the margin that we want to have, while the height depends on the number of windows that we want to have. These two numbers can...