Skip to content

Instantly share code, notes, and snippets.

@tomaszkacmajor
Created April 16, 2020 10:41
Show Gist options
  • Save tomaszkacmajor/a0076e935b10427ba153276817f080c8 to your computer and use it in GitHub Desktop.
Save tomaszkacmajor/a0076e935b10427ba153276817f080c8 to your computer and use it in GitHub Desktop.
def draw_lines(img, houghLines, color=[0, 255, 0], thickness=2):
for line in houghLines:
for rho,theta in line:
a = np.cos(theta)
b = np.sin(theta)
x0 = a*rho
y0 = b*rho
x1 = int(x0 + 1000*(-b))
y1 = int(y0 + 1000*(a))
x2 = int(x0 - 1000*(-b))
y2 = int(y0 - 1000*(a))
cv2.line(img,(x1,y1),(x2,y2),color,thickness)
def weighted_img(img, initial_img, α=0.8, β=1., λ=0.):
return cv2.addWeighted(initial_img, α, img, β, λ)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment