JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Loading...
Searching...
No Matches
RoadNavigation Class Reference

Road finder demo. More...

Inheritance diagram for RoadNavigation:
Collaboration diagram for RoadNavigation:

Public Member Functions

 RoadNavigation (std::string const &instance)
 Constructor.
 
virtual ~RoadNavigation ()
 Virtual destructor for safe inheritance.
 
virtual void process (jevois::InputFrame &&inframe) override
 Processing function, no video out.
 
virtual void process (jevois::InputFrame &&inframe, jevois::OutputFrame &&outframe) override
 Processing function with USB video out.
 
- Public Member Functions inherited from jevois::StdModule
 StdModule (std::string const &instance)
 
virtual ~StdModule ()
 
void sendSerialImg1Dx (unsigned int camw, float x, float size=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialStd1Dx (float x, float size=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialImg1Dy (unsigned int camh, float y, float size=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialStd1Dy (float y, float size=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialImg2D (unsigned int camw, unsigned int camh, float x, float y, float w=0.0F, float h=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialStd2D (float x, float y, float w=0.0F, float h=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialContour2D (unsigned int camw, unsigned int camh, std::vector< cv::Point_< T > > points, std::string const &id="", std::string const &extra="")
 
void sendSerialStd3D (float x, float y, float z, float w=0.0F, float h=0.0F, float d=0.0F, float q1=0.0F, float q2=0.0F, float q3=0.0f, float q4=0.0F, std::string const &id="", std::string const &extra="")
 
void sendSerialStd3D (std::vector< cv::Point3f > points, std::string const &id="", std::string const &extra="")
 
void sendSerialObjReco (std::vector< ObjReco > const &res)
 
void sendSerialObjDetImg2D (unsigned int camw, unsigned int camh, float x, float y, float w, float h, std::vector< ObjReco > const &res)
 
void sendSerialObjDetImg2D (unsigned int camw, unsigned int camh, ObjDetect const &det)
 
void sendSerialObjDetImg2D (unsigned int camw, unsigned int camh, ObjDetectOBB const &det)
 
 JEVOIS_DEFINE_ENUM_CLASS (SerStyle,(Terse)(Normal)(Detail)(Fine))
 
 JEVOIS_DECLARE_PARAMETER (serstyle, SerStyle, "Style for standardized serial messages as defined in " "http://jevois.org/doc/UserSerialStyle.html", SerStyle::Terse, SerStyle_Values, ParamCateg)
 
 JEVOIS_DECLARE_PARAMETER (serprec, unsigned int, "Number of decimal points in standardized serial messages as " "defined in http://jevois.org/doc/UserSerialStyle.html", 0U, jevois::Range< unsigned int >(0U, 10U), ParamCateg)
 
 JEVOIS_DEFINE_ENUM_CLASS (SerStamp,(None)(Frame)(Time)(FrameTime)(FrameDateTime))
 
 JEVOIS_DECLARE_PARAMETER (serstamp, SerStamp, "Prepend standardized serial messages with a frame number, " "time, frame+time, or frame+date+time. See details in " "http://jevois.org/doc/UserSerialStyle.html", SerStamp::None, SerStamp_Values, ParamCateg)
 
 JEVOIS_DEFINE_ENUM_CLASS (SerMark,(None)(Start)(Stop)(Both))
 
 JEVOIS_DECLARE_PARAMETER (sermark, SerMark, "Send serial message to mark the beginning (MARK START) of the " "processing of a video frame from the camera sensor, the end (MARK STOP), or both. " "Useful, among others, if one needs to know when no results were sent over serial " "on a given frame. Combine with parameter serstamp if you need to know the frame number.", SerMark::None, SerMark_Values, ParamCateg)
 
- Public Member Functions inherited from jevois::Module
 Module (std::string const &instance)
 
virtual ~Module ()
 
virtual void process (InputFrame &&inframe, GUIhelper &helper)
 
virtual void sendSerial (std::string const &str)
 
virtual void parseSerial (std::string const &str, std::shared_ptr< UserInterface > s)
 
virtual void supportedCommands (std::ostream &os)
 
- Public Member Functions inherited from jevois::Component
 Component (std::string const &instance)
 
virtual ~Component ()
 
std::shared_ptr< Comp > addSubComponent (std::string const &instance, Args &&...args)
 
void removeSubComponent (std::shared_ptr< Comp > &component)
 
void removeSubComponent (std::string const &instance, bool warnIfNotFound=true)
 
std::shared_ptr< Comp > getSubComponent (std::string const &instance) const
 
bool isTopLevel () const
 
bool initialized () const
 
std::string const & className () const
 
std::string const & instanceName () const
 
std::vector< std::string > setParamVal (std::string const &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor, bool doit)
 
void freezeAllParams (bool doit)
 
std::string descriptor () const
 
void setParamsFromFile (std::string const &filename)
 
std::istream & setParamsFromStream (std::istream &is, std::string const &absfile)
 
virtual void paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="")
 
void foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="")
 
std::shared_ptr< DynamicParameter< T > > addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category)
 
std::shared_ptr< DynamicParameter< T > > addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category)
 
void setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true)
 
void removeDynamicParameter (std::string const &name, bool throw_if_not_found=true)
 
void setPath (std::string const &path)
 
std::filesystem::path absolutePath (std::filesystem::path const &path="")
 
std::shared_ptr< Comp > addSubComponent (std::string const &instance, Args &&...args)
 
void removeSubComponent (std::shared_ptr< Comp > &component)
 
void removeSubComponent (std::string const &instance, bool warnIfNotFound=true)
 
std::shared_ptr< Comp > getSubComponent (std::string const &instance) const
 
bool isTopLevel () const
 
bool initialized () const
 
std::string const & className () const
 
std::string const & instanceName () const
 
std::vector< std::string > setParamVal (std::string const &paramdescriptor, T const &val)
 
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 
std::vector< std::pair< std::string, T > > getParamVal (std::string const &paramdescriptor) const
 
getParamValUnique (std::string const &paramdescriptor) const
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 
std::vector< std::pair< std::string, std::string > > getParamString (std::string const &paramdescriptor) const
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 
void freezeParam (std::string const &paramdescriptor, bool doit)
 
void freezeAllParams (bool doit)
 
std::string descriptor () const
 
void setParamsFromFile (std::string const &filename)
 
std::istream & setParamsFromStream (std::istream &is, std::string const &absfile)
 
virtual void paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="")
 
void foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="")
 
std::shared_ptr< DynamicParameter< T > > addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category)
 
std::shared_ptr< DynamicParameter< T > > addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category)
 
void setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true)
 
void removeDynamicParameter (std::string const &name, bool throw_if_not_found=true)
 
void setPath (std::string const &path)
 
std::filesystem::path absolutePath (std::filesystem::path const &path="")
 
- Public Member Functions inherited from jevois::ParameterRegistry
virtual ~ParameterRegistry ()
 

Protected Attributes

jevois::Timer itsProcessingTimer
 Module internals.
 
std::shared_ptr< RoadFinderitsRoadFinder
 

Related Symbols

(Note that these are not member symbols.)

 JEVOIS_DECLARE_PARAMETER (vpconf, float, "Minimum vanishing point confidence required to send a serial message. " "Note that currently, confidence values are binary (only 0 or 1), and quite conservative " "(many good detections may get a confidence of 0 if they are not very clean).", 0.0F, roadfinder::ParamCateg)
 Parameter.
 

Additional Inherited Members

- Protected Member Functions inherited from jevois::StdModule
void sendSerialMarkStart ()
 
void sendSerialMarkStop ()
 
std::string getStamp () const
 
- Protected Member Functions inherited from jevois::Component
virtual void preInit ()
 
virtual void postInit ()
 
virtual void preUninit ()
 
virtual void postUninit ()
 
virtual void preInit ()
 
virtual void postInit ()
 
virtual void preUninit ()
 
virtual void postUninit ()
 
- Protected Member Functions inherited from jevois::ParameterRegistry
void addParameter (ParameterBase *const param)
 
void removeParameter (ParameterBase *const param)
 
void callbackInitCall ()
 

Detailed Description

Road finder demo.

This algorithm detects road using a compination of edge detection and tracking, and texture analysis. The algorithm is an implementation of Chang, Siagian and Itti, IROS 2012, available at http://ilab.usc.edu/publications/doc/Chang_etal12iros.pdf

The algorithms combines detection and tracking of line segments at the edges of the road or on the road (e.g., lane dividers), and texture analysis to distinguish the road region from its surroundings. One strength of this algorithm is that it requires no training. No need to drive your robot on many roads to learn about the appearance of roads. The flipside of this, of course, is that driving on roads which do not look like standard roads or trails may fail.

The algorithm outputs the horizontal coordinate of the vanishing point of the road, which usually is a good indication of the road heading (except in very tight bends or corners).

Demo display outputs

Detected line segments are shown in black and white, while segments that have been reliably tracked over multiple frames are shown in thick purple. Estimated vanishing point location and confidence is shown as a big green disk on the horizon line.

Note that the demo display runs much slower than the algorithm with no video output (which should be used on autonomous cars), simply because drawing all the detected line segments takes a lot of time.

Serial Messages

This module can send standardized serial messages as described in Standardized serial messages formatting. One 1D message is issued on every video frame for the vanishing point's horizontal location.

  • Serial message type: 1D
  • id: always vp (shorthand for vanishing point)
  • x: standardized 2D horizontal coordinate of the vanishing point
  • w: always 0.
  • extra: none (empty string)

See Standardized serial messages formatting for more on standardized serial messages, and Helper functions to convert coordinates from camera resolution to standardized for more info on standardized coordinates.

Trying it out

To casually try out this module, just search the web for pictures of roads and point the JeVois camera to one of them. Make sure that you align the horizon line of the algorithm (which has a number of purple and green disks) roughly with the horizon line in your picture. As you move the camera left and right, the location of the large green disk that marks the detected vanishing point should move left and right, and should point to the vanishing point of the road in your image.

When using on a mobile robot in the real world, setting the proper horizon line is essential for good operation of the algorithm. This is determined by parameter horizon, which should be tuned according to the height and tilt angle of the JeVois camera on your vehicle.

Author
Laurent Itti
Videomapping:
NONE 0 0 0 YUYV 320 240 30.0 JeVois RoadNavigation
Videomapping:
NONE 0 0 0 YUYV 176 144 120.0 JeVois RoadNavigation
Videomapping:
YUYV 320 256 30.0 YUYV 320 240 30.0 JeVois RoadNavigation
Videomapping:
YUYV 176 160 120.0 YUYV 176 144 120.0 JeVois RoadNavigation
Email:
itti@usc.edu
Address:
University of Southern California, HNB-07A, 3641 Watt Way, Los Angeles, CA 90089-2520, USA
Main URL:
http://jevois.org
Support URL:
http://jevois.org/doc
Other URL:
http://iLab.usc.edu
License:
GPL v3
Distribution:
Unrestricted
Restrictions:
None

Definition at line 108 of file RoadNavigation.C.

Constructor & Destructor Documentation

◆ RoadNavigation()

RoadNavigation::RoadNavigation ( std::string const &  instance)
inline

Constructor.

Definition at line 114 of file RoadNavigation.C.

References itsRoadFinder.

◆ ~RoadNavigation()

virtual RoadNavigation::~RoadNavigation ( )
inlinevirtual

Virtual destructor for safe inheritance.

Definition at line 123 of file RoadNavigation.C.

Member Function Documentation

◆ process() [1/2]

virtual void RoadNavigation::process ( jevois::InputFrame &&  inframe)
inlineoverridevirtual

Processing function, no video out.

Reimplemented from jevois::Module.

Definition at line 128 of file RoadNavigation.C.

References itsRoadFinder, and jevois::StdModule::sendSerialImg1Dx().

◆ process() [2/2]

Friends And Related Symbol Documentation

◆ JEVOIS_DECLARE_PARAMETER()

JEVOIS_DECLARE_PARAMETER ( vpconf  ,
float  ,
"Minimum vanishing point confidence required to send a serial message. " "Note that  currently,
confidence values are   binaryonly 0 or 1,
and quite conservative " "(many good detections may get a confidence of 0 if they are not very clean)."  ,
0.  0F,
roadfinder::ParamCateg   
)
related

Parameter.

Member Data Documentation

◆ itsProcessingTimer

jevois::Timer RoadNavigation::itsProcessingTimer
protected

Module internals.

Definition at line 204 of file RoadNavigation.C.

Referenced by process().

◆ itsRoadFinder

std::shared_ptr<RoadFinder> RoadNavigation::itsRoadFinder
protected

Definition at line 205 of file RoadNavigation.C.

Referenced by process(), process(), and RoadNavigation().


The documentation for this class was generated from the following file: