I have an assignment where i need to detect the edges of a simple rectangle in this image. I am a little bit lost in the last part where my teacher ask us to extract the spatial coordinates from the Hough coordinates using 𝜌=𝑥cos(𝜃)+𝑦sin(𝜃).

He said :

"Find the intersection of these lines which corresponds to the four

corners of the plate. Obtain these coordinates and apply a binary mask

on the original image in order to obtain only the plate. When you get

the pixel coordinates of the corners of the license plate, you can use

the function provided with this assignment.For the calculation of the intersection points, we can use the normal

form: xcos (theta) + ysin (theta) - rho. If we create a matrix with

this equation, replacing x and y by the position of the pixels and

theta, rho by the parameters of the detected line, we will obtain a

matrix for which the intensities will take a value of 0 when we are on

the line. We can thus identify the pixels in the image belonging to

the line. We can repeat for all the detected lines and use this

result to find the place where the lines intersect."

I am blocked here i tried something but its far from the good way i think … i dont really get how to properly use 𝜃 and 𝜌 to do the job.

```
from skimage.feature import peak_local_max
import math
Local_Max= peak_local_max(out, num_peaks=6,min_distance=15 ,exclude_border=False)
# cadrage is the input of hough_line...its the rectangle
y,x = cadrage.shape
array = np.arange(x*y).reshape(y,x)
# filling the matrix with the equation
for i in range(y):
for j in range(x):
array[i,j] = (i * math.cos(angles[1])) + (j * math.sin(angles[1])) - d[1]
```