Dimension
Dimension
import numpy as np
rectangles = []
for line in lines:
x1, y1, x2, y2 = line[0]
if abs(y2 - y1) < 10: # filter horizontal lines
continue
slope = (y2 - y1) / (x2 - x1) if x1 != x2 else float('inf')
if abs(slope - 0) < 0.1 or abs(slope - np.inf) < 0.1: # filter horizontal
and vertical lines
continue
if x1 < image.shape[1] / 2:
rectangles.append((x1, y1, x2, y2))
else:
rectangles.append((x2, y2, x1, y1))
return rectangles
return result
cv2.imwrite('output_image.jpg', blurred_image)
cv2.waitKey(0)
cv2.destroyAllWindows()