Canny algorithm to create a binary image and then use the HoughLinesP function detects line in binary image.
First we take the bird eye view image of straight labe for processing.
When the HoughLinesP is applied we get following resulting lines:
Then we take a curved lane image
When the HoughLinesP is applied we get following resulting lines:
Here is the code.
int hough(const char *input_path, const char *output_path)
{
Mat src_o, src, dst;
src_o = imread(input_path);
cvtColor(src_o, src, CV_BGR2GRAY );
Canny(src, dst, 200, 255, 3 );
vector lines;
HoughLinesP(dst, lines, 1, CV_PI/180, 20, 10, 20 );
std::map candidate;
for( size_t i = 0; i < lines.size(); i++ )
{
line( src_o, Point(lines[i][0], lines[i][1]),
Point(lines[i][2], lines[i][3]), Scalar(0,0,255), 3, 8 );
}
imwrite(output_path, src_o);
return 0;
}
Next step is to take the lines and calculate the lane midpoint.




Detecting lane markings from road images is a classic computer vision task that forms an essential part of autonomous vehicle perception systems. Readers interested in implementing similar vision-based solutions can further explore Image Processing Projects For Final Year, where image enhancement, feature extraction, and real-time visual analysis techniques are applied to practical engineering problems.
ReplyDeleteSince this tutorial primarily focuses on identifying road lane lines using edge detection and Hough Transform rather than object recognition, learning from Image Segmentation Projects can further strengthen understanding of road scene analysis, lane boundary extraction, and advanced perception methods used in intelligent transportation systems.
ReplyDelete