import cv2 import numpy as np def canny_detect(image_path, is_gray=True): image = cv2.imread(image_path) if is_gray: gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) else: gray = image edges = cv2.Canny(gray, threshold1, threshold2) return edges def hough_detect(image_path): image = cv2.imread(image_path) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) edges = canny_detect(image_path, False) lines = cv2.HoughLines(edges, 1, np.pi/180, 200) # for line in lines: # rho, theta = line123