How many degrees of freedom does a line have on a plane? Using $y=ax+b$ I can get a line for every point $(a,b)$ but there are still some lines left $(x=c)$. So it seems that lines are more than points so they have more degrees of freedom than $2$. How many?
You have indeed two degrees of freedom, but the problem is that the correspondence is not "perfect" with points of the plane $\mathbb{R}^2$. It is nicer with points in $\mathbb{R}^{+}\times S^1$, where $S^1$ is the circle and $\mathbb{R}^+$. is the ray of non-negative real numbers. 

Let us see what this means, but before let me point out that even though the correspondence in your post doesn't cover one of the lines in the plane, it is ok, to determine degrees of freedom to allow considering correspondences that skip a set of states of the system that is small (has smaller dimension). So, your analysis also shows that there are two degrees of freedom, even though the single line $x=c$ is skipped.

By $S^1$ above we are denoting the circle. For each line on the plane we have its angle with respect to the positive part of the $X$-axis. We only need to consider angles between $0$ and $\pi$ and consider $0$ the same angle as $\pi$. Take into account that when you rotate more than and angle larger than $\pi$ you are getting an slope that can also be obtained with an angle smaller than $\pi$. Each of these angles corresponds to a point in the circle. 

Having a line we also have the distance to the line from the origin. This is a non-negative real number. 

The distance to the origin and the angle determines the line and conversely each line determines the distance to the origin and the angle.

We can put all of these in formulas. A general line in the plane can be written as 
$$ax+by=c$$

The vertical lines fall in the case that $b=0$. This equation is unique up to multiplication by a non-zero constant. For example, multiplying by $r\neq0$ we get an equation $$rax+rby=rc$$ that defines the same line.

There is a unique angle $0\leq \theta&lt;\pi$ such that $b\cdot\tan(\theta)=-a$, where we assume $\theta=\pi/2$ when $b=0$. This is the angle we discussed above.

The distance from the origin to this line is $$d=\frac{|c|}{\sqrt{a^2+b^2}}$$

We can go the other way around. If we have $\theta$ then we can find a pair $a,b$ such that $b\tan(\theta)=-a$. This pair is not unique, but it is up to multiplication by a constant $r\neq0$, which is all we need. One you have an $a,b$ pair you can use the given $d$ and solve for $$c=d\cdot\sqrt{a^2+b^2}$$

We removed the absolute value from $c$ because we are allowed to multiply the whole equation $ax+by=c$ by $-1$ if we want, and still get the same line. We can always assume we want $c\geq0$.
A segment of any line can be scaled, translated and rotated on a plane so there are three DOF. The last two are Euclidean motions that are constants of integration of differential equations of motion in the plane.

EDIT1:

Taking a view that whatever is added on in integration can be viewed as a degree of freedom (DOF). 

In the plane, $ \dfrac{dy}{dx}=m $ gives one DOF. Integrating $ y = mx + C $ adds one more DOF, now $ (m,C) $. It is same if we use polar coordinates $ x \cos \alpha + y \sin \alpha = p $, two constants or  parameters $( p, \alpha) $ . 

For a straight line segment when limits are included it may be viewed as a DOF in the sense of dilation.