Description
This issue addresses several bugs and improvement areas in the Finding_Lanes project:
- Path Resolution Issue: Hardcoded relative paths (
Finding_Lanes/video.mp4 in lanes.py and Finding_Lanes/picture.jpg in sub.py) cause FileNotFoundError or video load failure when running the scripts from within the Finding_Lanes directory as instructed in README.md.
- Missing Frame Validation:
lanes.py does not check ret or frame is None from cap.read(), causing an unhandled OpenCV exception (cv2.cvtColor on empty image) when reaching EOF or frame read failure.
- Empty Hough Lines Crash:
average_lines_intercept() raises a TypeError when HoughLinesP returns None, or crashes when left/right fit arrays are empty (e.g. no left or right lane line detected).
- Incomplete README:
README.md contains placeholder text under the description section (A short description about the script must be mentioned here.).
Proposed Fixes
- Use
os.path relative to __file__ for dynamic asset path resolution in lanes.py and sub.py.
- Add frame validation check (
if not ret or frame is None: break) in lanes.py.
- Add null and empty array checks in
average_lines_intercept() and make_coordinate() to gracefully handle undetected lane lines.
- Complete the
README.md description section with project details.
Description
This issue addresses several bugs and improvement areas in the
Finding_Lanesproject:Finding_Lanes/video.mp4inlanes.pyandFinding_Lanes/picture.jpginsub.py) causeFileNotFoundErroror video load failure when running the scripts from within theFinding_Lanesdirectory as instructed inREADME.md.lanes.pydoes not checkretorframe is Nonefromcap.read(), causing an unhandled OpenCV exception (cv2.cvtColoron empty image) when reaching EOF or frame read failure.average_lines_intercept()raises aTypeErrorwhenHoughLinesPreturnsNone, or crashes when left/right fit arrays are empty (e.g. no left or right lane line detected).README.mdcontains placeholder text under the description section (A short description about the script must be mentioned here.).Proposed Fixes
os.pathrelative to__file__for dynamic asset path resolution inlanes.pyandsub.py.if not ret or frame is None: break) inlanes.py.average_lines_intercept()andmake_coordinate()to gracefully handle undetected lane lines.README.mddescription section with project details.