Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Active-Lane-Keeping-Assistant/lane.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
class Lane:
"""Detects Lanes in a given Image
"""

HLS_L_THRESHOLD_MIN = 150
HLS_L_THRESHOLD_MAX = 255
def __init__(self, height:int, width:int, save:bool=False,
save_folder:str=join('img', 'examples')) -> None:
"""Constructor
Expand Down Expand Up @@ -56,7 +57,7 @@ def get_lines(self, img:np.ndarray) -> np.ndarray:

# Create threshold matrix to differentiate black and white based on the
# lightness (of HSL).
_, binary = cv2.threshold(hls[:, :, 1], 150, 255, cv2.THRESH_BINARY)
_, binary = cv2.threshold(hls[:, :, 1], self.HLS_L_THRESHOLD_MIN, self.HLS_L_THRESHOLD_MAX, cv2.THRESH_BINARY)
binary_blured = cv2.GaussianBlur(binary, (3, 3), 0)

if self.save:
Expand Down
2 changes: 1 addition & 1 deletion src/Active-Lane-Keeping-Assistant/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def run(id:str, path:str, world:World, agent:Agent, steps:int = 100,
steer, throttle = agent.get_actions(detection_surface_area, error)
error, detection_surface_area, img, collision_detected = world.step(
steer=steer, throttle=throttle)
agent.show_error()
#agent.show_error()

if save:
recorder.add_image(img=img)
Expand Down
2 changes: 1 addition & 1 deletion src/Active-Lane-Keeping-Assistant/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self,
folder (str, optional): Storage location. Defaults to 'videos'.
"""

self.cameraCapture = cv2.VideoCapture(0)
#self.cameraCapture = cv2.VideoCapture(0)
self.height = height
self.width = width
self.fps = float(fps)
Expand Down
Loading