Image I have a problem with detected contours. The contours are as in the attached photo. I would like to remove all the inscriptions from them (connect the broken lines in these places) and align their course so that they are as close to straight lines as possible. I tried to detect the contours using different methods. Currently my code looks like this: def detect_wires(image_path, lower_color, upper_color): img = cv2.imread(image_path) img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) mask = cv2.inRange(img_hsv, np.array(lower_color), np.array(upper_color)) contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) return contours Are there any easy ways to do this? Continue reading...