Repository navigation
Fix(Finding_Lanes): Fix ROI color corruption, cross-lane contamination, add LaneTracker smoothing & drivable corridor (#603) - #604
Open
Prayas340 wants to merge 1 commit into
Conversation
…add LaneTracker smoothing & drivable corridor (fixes ndleah#603) - Fix 3-channel color zeroing in roi() by populating all channels in mask - Add spatial midpoint constraints to average_lines_intercept() to eliminate cross-lane contamination - Implement LaneTracker class with exponential moving average (EMA) smoothing and frame dropout retention - Add --fill-lane CLI flag to visualize drivable road corridor polygon - Correct gamma offset in cv2.addWeighted from 1.0 to 0.0 - Synchronize video playback delay with native video FPS - Add Finding_Lanes/requirements.txt - Expand unit test suite to 22 test cases with 100% pass rate - Add Finding_Lanes/ISSUE.md and Finding_Lanes/PULL_REQUEST.md documentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This Pull Request addresses critical computer vision bugs, filtering defects, missing temporal stabilization, and CLI limitations in the
Finding_Lanesproject:Fix Multi-Channel Color Corruption in
roi()Mask:cv2.fillPoly(mask, polygons, 255)applied integer scalar255, which only populated channel 0 (blue) and wiped out channels 1 (green) and 2 (red) on 3-channel color images.(255,) * channelsfor multi-channel frames, preserving full RGB/BGR color data.Fix Unconstrained Slope Averaging & Cross-Lane Contamination:
average_lines_intercept(), segments were previously segregated solely based on slope signs (slope < -min_slopevsslope > min_slope).line_mid_x < midpointfor left lanes,line_mid_x > midpointfor right lanes). This prevents negative-slope noise markings, shadows, or guardrails on the right half of the road from contaminating the left lane model.Add Temporal Lane Tracking & Smoothing (
LaneTracker):LaneTrackerclass using an Exponential Moving Average (EMA) filter to eliminate frame-to-frame video jitter.max_missed_frames=15) so that brief gaps between dashed road lane markings no longer cause the lane line to flicker or disappear.Add Drivable Lane Corridor Visualization (
--fill-lane):--fill-laneCLI flag and parameter to render a semi-transparent filled polygon between the left and right lane boundaries, highlighting the vehicle's drivable lane corridor.Fix Gamma Offset (+1 Brightness Shift) in
cv2.addWeighted:gamma=1.0to standardgamma=0.0inprocess_frame()to avoid artificially washing out and brightening image frames.Fix CLI Exit Codes and Error Handling:
sys.exit(1)when input files or video streams are invalid or not found, ensuring compatibility with CI/CD and automated scripting pipelines.Add Dependencies Specification (
requirements.txt):requirements.txtspecifyingopencv-python>=4.5.0,numpy>=1.20.0, andmatplotlib>=3.3.0.Comprehensive Automated Unit Test Suite (
test_lanes.py):Documentation Overhaul (
README.md):--fill-lane,--no-smooth,--no-show), installation instructions, and updated project structure.Fixes #603
Type of change
Choosing one or more options from the following as per the nature of your Pull request:
Project
Your Project Name: Finding Lanes - Computer Vision Lane Detection
Short Description: Real-time road lane detection and drivable corridor visualization using OpenCV and NumPy, featuring Canny edge detection, dynamic ROI, Hough transform, slope-intercept regression, and temporal EMA smoothing.
Checklist:
Please tick all the boxes that are fulfilled by your Pull Request.
README.md, according to the givenREADME_TEMPLATE.