# Affine rectification via vanishing line

I'm trying to understand how to rectify an image given some lines that should actually be parallel in the final image. For example:

from the book Multiple View Geometry. I know that the idea is to form a transformation such that the identified lines map to the line at inifinty in the resultin image, but I don't understand how this can work.

The idea would be to use: $$H = H_{A} \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ l_1 & l_2 & l_3 \end{bmatrix}$$

where the image line at inifinity is $$\mathbf{l} = (l_1, l_2, l_3)^{T}, l_3 \neq 0$$ and $$H_A$$ is an affine transformation.

What would the matrix A be and how does this help the rectification? I'm confused on how this works. Thanks for any help.