Skip to content

Trace the edge of the road in a hallway, and mark out the center line of the road

Notifications You must be signed in to change notification settings

YihuiGuo/RoadTracer-EmguCv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RoadTracer with EmguCV

##Briefing This is a CV module used to tell whether the current camera position is on the center line of the road or hallway. The program is written in C# with EmguCV. ##Structure ####*RoadTracer this is a class library project, which generates RoadTracer.dll. The project contains these:
######->LineHelper.cs Wrapped some tool functions like calculating the distance to a line, and find the coordinate of the intersection of two lines. ######->Operator.cs Kernel logical process of finding proper lines and calculating bisectors. ######->TextException.cs My Own exception type, maybe useful in the future? ####*TestConsole A console application to test static images. Exceptions will be shown on the terminal window and break the process. ####*TestWpf A Wpf Application to test video stream, any exceptions will stop current process and go on with next frame. Except for MainWindow.xaml, App.xaml and some basic things, I added this: ######->UIHandler.cs To display or change the image shown on the form is sooooo complicated in wpf, especially with Emgu.CV.Image<>. Then I wrapped this in the class. ##User Tips RoadTracer is a class library, so you could build this project once, find the RoadTracer.dll in its /bin directory, and use that as a reference in your own project.

This works with emgucv-windows-universal-cuda 2.4.10.1940.

Remember: Applications could only run when you copy this folder: /install_position_of_EmguCV/bin/x86 to /Your_application/bin/Debug/

You can also find BetterTogether.dll in TestWpf. which is used for testing the application with a Windows Phone running an unique application. Feel free to use a web cam instead. Remember to change the Width and Height parameters in RoadTracer::Operator.cs ##How it works? For an incoming frame, like this: image
First,the contour will be extracted with canny method. Considering the upper part of the images contains few things about the road, I took the lower part for ROI. image
Then , based on canny contours, several HoughLines will be calculated. image
After filtering unreasonable lines, the rest of the lines will be preserved and calculate the vanishing point of the image. The bisector of the angle formed by the vanishing point and the edge of the two sides of the hallway will be the center line. image

I will add some other examples : image image image image

image image image image

image image image image

Hope it helps!

About

Trace the edge of the road in a hallway, and mark out the center line of the road

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%