Research Article

Computer Vision and the IoT-Based Intelligent Road Lane Detection System

Algorithm 2

Hough transform method.
Step 1: A couple of videos are used as data to detect the lanes in the videos. The video is loaded to read each frame using the function VideoReader of Matlab.
Step 2: The Gaussian filter is applied to every frame in the image to remove noises in the image using the function imgaussfilt3.
Step 3: Yellow and white color masking is done to the frame.
Note: Lanes on the road are present in yellow and white colors.
Step 4: Then the Canny edge detection algorithm is applied to identify the edges of the yellow and white color regions in the image.
Step 5: The unwanted small group of pixels is removed using the function bare open.
Step 6: The region of interest is selected using the function roipoly in every frame of the video. This yields the region of the image where only lanes are present.
Step 7: The Hough transform is applied to the interested region to detect the lanes using the function hough. Further, Hough peaks function is used to determine the parameter space’s peak values. The potential lines in the input image are represented by these peaks.
Step 8: The Hough lines function is used to locate the endpoints of line segments in the Hough transform that correspond to peaks. This function fills in minor gaps in line segments automatically.
Step 9: The slope of the left and right lanes is calculated, which is further used to extrapolate the broken road lanes if any.
Step 10: The cross product of both the vector lines is calculated to obtain the vanishing point, and its ratio to the frame size yields the vanishing ratio.
Step 11: The turn is predicted based on the obtained magnitude of the vanishing ratio (VR).
(i)Straight if VR ≃ 0.5.
(ii)Left if 0.47 ≤ VR < 0.49.
(iii)Right if VR > 0.5.