Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python lane angle detection

from skimage.transform import (hough_line, hough_line_peaks)
import numpy as np
import cv2

image = cv2.imread('2.png')

# Compute arithmetic mean
image = np.mean(image, axis=2)

# Perform Hough Transformation to detect lines
hspace, angles, distances = hough_line(image)

# Find angle
angle=[]
for _, a , distances in zip(*hough_line_peaks(hspace, angles, distances)):
    angle.append(a)

# Obtain angle for each line
angles = [a*180/np.pi for a in angle]

# Compute difference between the two lines
angle_difference = np.max(angles) - np.min(angles)
print(angle_difference)
Comment

PREVIOUS NEXT
Code Example
Python :: jupyter notebook print string with variables 
Python :: ValueError: Could not load "" Reason: "broken data stream when reading image file" 
Python :: python tupel from string 
Python :: Pouring 8 litres into 2 empty container of size 3 and 5 to get 4 litre in any container 
Python :: how to restore windows security 
Python :: pandas return indices that match 
Python :: nlargest of each group 
Python :: filter numbers with bounds filter_bounds python 
Python :: Hewwo wowwd 
Python :: Using a generic exception block 
Python :: using a print function 
Python :: how to add to an index in a list in python 
Python :: python structure like c 
Python :: line to curve dynamo revit 
Python :: how to install python on visual studio code 
Python :: how to loop through a list from the last element in python 
Python :: django froms 
Python :: plotly colors 
Python :: text python 
Python :: python inspect class 
Python :: format python decimal 
Python :: python bytes to hex 
Python :: class python example 
Python :: numpy square root 
Python :: python ^ symbol 
Python :: function to scale features in dataframe 
Python :: camel case to snake case python 
Python :: update all modules python 
Python :: pip path windows 10 
Python :: arithmetic operators in python 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =