Skip to content

Instantly share code, notes, and snippets.

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))
@tomaszkacmajor
tomaszkacmajor / houghlines_in_python.py
Created April 16, 2020 10:39
HoughLines in Python
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
image = mpimg.imread("test_images/ppnt.jpg")
gray_image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
blurred_image = cv2.GaussianBlur(gray_image, (9, 9), 0)
edges_image = cv2.Canny(blurred_image, 50, 120)
using System;
namespace GenericsTests1
{
class Program
{
static void Main(string[] args)
{
ExampleClass example = new ExampleClass();
example.RunAll();