How to find certain line pattern on image

#!/usr/bin/env python3
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt

original_img = cv.imread("base_file.bmp", cv.IMREAD_GRAYSCALE)
cv.namedWindow("original_img", cv.WINDOW_NORMAL)
cv.imshow("original_img", original_img)

reit, threshold_img = cv.threshold(original_img, 41, 255, cv.THRESH_BINARY)
print("threshold: ", threshold_img)
cv.namedWindow("threshold_img", cv.WINDOW_NORMAL)
cv.imshow("threshold_img", threshold_img)
cv.waitKey(1)

h, w = threshold_img.shape
gy, _ = np.mgrid[0:h, 0:w]

profilesum = np.sum(threshold_img, axis=0)

# weighted sum, calculates the "center of mass" for every column
profile = np.sum(threshold_img * gy, axis=0) / profilesum

# alternative: find first and last white pixel of every column, calculate midpoint

# let's only consider columns that have at least 10 pixels set
# less causes some noise
# OpenCV uses 0 and 255 for thresholded/binary pictures
# I need 0/1 for this step:
boolean_img = (threshold_img > 0)
profilevalid = (np.sum(boolean_img, axis=0) >= 10)

# nans aren't plotted
# invalidate columns that have less than 10 pixels set
profile[~profilevalid] = np.nan

gradient = np.gradient(profile)
#print("gradient: ", gradient)

extremum_value = np.nanmin(gradient, axis=0) # nanmin: min but ignore nans
print("extremum_value: ", extremum_value)

extremum_x = np.nanargmin(gradient)
print("extremum_x: ", extremum_x)

fig, axs = plt.subplots(2, sharex=True)
fig.set_size_inches(12, 6)
axs[0].axvline(x=extremum_x, color='r', dashes=(1,2))
axs[0].plot(profile)
axs[1].plot([extremum_x], [extremum_value], 'ro')
axs[1].plot(gradient)
fig.tight_layout()
plt.show()
cv.destroyAllWindows()