I'm using an image processing library (aForge) to process images. In this case, I'm trying to pick out a playing card from an image. aForge calculates Hough Lines, for any edges that it detects. Each Hough Line is produced in a polar coordinate from the center of the image. Here's an example, along with angle (Theta) and radius (Rad).
I want to extract the card, in order run it through an image recognition to identify suit and rank.
To extract the card, I need to calculate the intersection of the lines, then cut out the rectangular(ish) image.
Here's a sample, the Hough Lines appear in pink, the selected 1st Hough Line appears in bold.
Best Answer
The intersection point $(x,y)$ of two Hough Lines
$$ \begin{aligned} x \cos \theta_1 + y \sin \theta_1 &= r_1 \\ x \cos \theta_2 + y \sin \theta_2 &= r_2 \\ \end{aligned}$$
is given by
$$\begin{aligned} x & = \frac{r_2 \sin \theta_1 - r_1 \sin \theta_2}{\sin(\theta_1-\theta_2)} \\ y & = \frac{r_1 \cos \theta_2 - r_2 \cos \theta_1}{\sin(\theta_1-\theta_2)} \\ \end{aligned}$$