How to find certain line pattern on image

Thank you @crackwitz. Your solution works very well.
By the way, I got better results on the thresholded image.

How can I get the value of x for the smallest y? I tried np.min(gradient, axis=0), but I got nan. When I print gradient all values are nan.

In the above example, we assume that the line is horizontal. I understand that if the line will be vertical I need to calculate the x coordinate of mean brightness.
How can I deal with a line which diagonal (or has an unknown angle)?

How to deal with multiple lines in different directions?